Skip to content

Commit

Permalink
Merge pull request FFTW#110 from junghans/cmake
Browse files Browse the repository at this point in the history
Minor cmake fixes
  • Loading branch information
matteo-frigo authored Sep 22, 2017
2 parents 04590cb + e09ab8c commit 2dd7738
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
34 changes: 23 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ option (ENABLE_SSE2 "Compile with SSE2 instruction set support" OFF)
option (ENABLE_AVX "Compile with AVX instruction set support" OFF)
option (ENABLE_AVX2 "Compile with AVX2 instruction set support" OFF)

set (LIBRARY_PATH lib${LIB_SUFFIX})
include(GNUInstallDirs)


include (CheckIncludeFile)
Expand Down Expand Up @@ -241,7 +241,7 @@ set (fftw_threads_SOURCE ${fftw_par_SOURCE} threads/threads.c)
set (fftw_omp_SOURCE ${fftw_par_SOURCE} threads/openmp.c)


include_directories(.)
include_directories (.)


if (WITH_COMBINED_THREADS)
Expand Down Expand Up @@ -338,14 +338,19 @@ endif ()
foreach(subtarget ${subtargets})
set_target_properties (${subtarget} PROPERTIES SOVERSION 3.5.7 VERSION 3)
install (TARGETS ${subtarget}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIBRARY_PATH}
ARCHIVE DESTINATION ${LIBRARY_PATH})
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endforeach ()
install(TARGETS ${fftw3_lib}
EXPORT FFTW3LibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install (FILES api/fftw3.h DESTINATION include RENAME fftw3${PREC_SUFFIX}.h)
install (FILES api/fftw3.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if (EXISTS api/fftw3.f)
install (FILES api/fftw3.f DESTINATION include RENAME fftw3${PREC_SUFFIX}.f)
install (FILES api/fftw3.f DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()

if (BUILD_TESTS)
Expand Down Expand Up @@ -376,20 +381,27 @@ endif ()
# pkgconfig file
set (prefix ${CMAKE_INSTALL_PREFIX})
set (exec_prefix ${CMAKE_INSTALL_PREFIX})
set (libdir ${CMAKE_INSTALL_PREFIX}/${LIBRARY_PATH})
set (includedir ${CMAKE_INSTALL_PREFIX}/include)
set (libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set (VERSION ${FFTW_VERSION})
configure_file (fftw.pc.in fftw${PREC_SUFFIX}.pc @ONLY)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/fftw${PREC_SUFFIX}.pc
DESTINATION ${LIBRARY_PATH}/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT Development)

# cmake file
set (FFTW3_LIBRARIES "FFTW3::${fftw3_lib}")
configure_file (FFTW3Config.cmake.in FFTW3${PREC_SUFFIX}Config.cmake @ONLY)
configure_file (FFTW3ConfigVersion.cmake.in FFTW3${PREC_SUFFIX}ConfigVersion.cmake @ONLY)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}ConfigVersion.cmake
DESTINATION ${LIBRARY_PATH}/cmake/fftw3
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX}
COMPONENT Development)

export (TARGETS ${fftw3_lib} NAMESPACE FFTW3:: FILE ${PROJECT_BINARY_DIR}/FFTW3LibraryDepends.cmake)
install(EXPORT FFTW3LibraryDepends
NAMESPACE FFTW3::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX}
COMPONENT Development)
15 changes: 12 additions & 3 deletions FFTW3Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ if (CMAKE_VERSION VERSION_LESS 2.8.3)
get_filename_component (CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif ()

set (FFTW3@PREC_SUFFIX@_LIBRARIES @fftw3_lib@)
set (FFTW3@PREC_SUFFIX@_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@LIBRARY_PATH@)
set (FFTW3@PREC_SUFFIX@_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include)
# Allows loading FFTW3 settings from another project
set (FFTW3_CONFIG_FILE "${CMAKE_CURRENT_LIST_FILE}")

set (FFTW3@PREC_SUFFIX@_LIBRARIES fftw3@PREC_SUFFIX@)
set (FFTW3@PREC_SUFFIX@_LIBRARY_DIRS @CMAKE_INSTALL_FULL_LIBDIR@)
set (FFTW3@PREC_SUFFIX@_INCLUDE_DIRS @CMAKE_INSTALL_FULL_INCLUDEDIR@)

include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3LibraryDepends.cmake")

if (CMAKE_VERSION VERSION_LESS 2.8.3)
set (CMAKE_CURRENT_LIST_DIR)
endif ()
10 changes: 7 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,15 @@ pkgconfig_DATA = fftw3@[email protected]
FFTW3@[email protected]: $(top_srcdir)/FFTW3Config.cmake.in
$(SED) \
-e 's|[@]PREC_SUFFIX@|@PREC_SUFFIX@|g' \
-e 's|[@]libdir@|$(libdir)|g' \
-e 's|[@]includedir@|$(includedir)|g' \
-e 's|[@]CMAKE_INSTALL_FULL_LIBDIR@|$(libdir)|g' \
-e 's|[@]CMAKE_INSTALL_FULL_INCLUDEDIR@|$(includedir)|g' \
$(top_srcdir)/FFTW3Config.cmake.in > $@
FFTW3@[email protected]: $(top_srcdir)/FFTW3ConfigVersion.cmake.in
$(SED) \
-e 's|[@]FFTW_VERSION@|@PACKAGE_VERSION@|g' \
$(top_srcdir)/FFTW3ConfigVersion.cmake.in > $@
cmakedir = $(libdir)/cmake/fftw3
cmake_DATA = FFTW3@[email protected]
cmake_DATA = FFTW3@[email protected] FFTW3@[email protected]

WISDOM_DIR = /etc/fftw
WISDOM = wisdom@PREC_SUFFIX@
Expand Down

0 comments on commit 2dd7738

Please sign in to comment.