Skip to content

Commit

Permalink
CMake: Adapt FFTW find module to match FFTW3Config.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jan 4, 2021
1 parent f79eda9 commit 9914bcd
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 72 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ add_library(keyfinder "${LIBMODE}"
)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(FFTW REQUIRED)
target_link_libraries(keyfinder PUBLIC FFTW::FFTW)
find_package(FFTW3 REQUIRED)
target_link_libraries(keyfinder PUBLIC FFTW3::fftw3)
target_include_directories(keyfinder PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

include(GNUInstallDirs)
Expand Down
70 changes: 0 additions & 70 deletions cmake/FindFFTW.cmake

This file was deleted.

70 changes: 70 additions & 0 deletions cmake/FindFFTW3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#[=======================================================================[.rst:
FindFFTW3
--------
Finds the FFTW3 library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``FFTW3::fftw3``
The FFTW3 library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``FFTW3_FOUND``
True if the system has the FFTW3 library.
``FFTW3_INCLUDE_DIRS``
Include directories needed to use FFTW3.
``FFTW3_LIBRARIES``
Libraries needed to link to FFTW3.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``FFTW3_INCLUDE_DIR``
The directory containing ``fftw3.h``.
``FFTW3_LIBRARY``
The path to the FFTW3 library.
#]=======================================================================]

find_path(FFTW3_INCLUDE_DIR
NAMES fftw3.h
DOC "FFTW3 include directory")
mark_as_advanced(FFTW3_INCLUDE_DIR)

find_library(FFTW3_LIBRARY
NAMES fftw fftw3 fftw-3.3
DOC "FFTW3 library"
)
mark_as_advanced(FFTW3_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
FFTW3
DEFAULT_MSG
FFTW3_LIBRARY
FFTW3_INCLUDE_DIR
)

if(FFTW3_FOUND)
set(FFTW3_LIBRARIES "${FFTW3_LIBRARY}")
set(FFTW3_INCLUDE_DIRS "${FFTW3_INCLUDE_DIR}")

if(NOT TARGET FFTW3::fftw3)
add_library(FFTW3::fftw3 UNKNOWN IMPORTED)
set_target_properties(FFTW3::fftw3
PROPERTIES
IMPORTED_LOCATION "${FFTW3_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR}"
)
endif()
endif()

0 comments on commit 9914bcd

Please sign in to comment.