Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find the version of FFTW and check for minim required #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion FindFFTW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
# Copyright (c) 2017, Patrick Bos
#
# Usage:
# find_package(FFTW [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )
# find_package(FFTW [version] [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )
#
# It sets the following variables:
# FFTW_FOUND ... true if fftw is found on the system
# FFTW_[component]_LIB_FOUND ... true if the component is found on the system (see components below)
# FFTW_LIBRARIES ... full paths to all found fftw libraries
# FFTW_[component]_LIB ... full path to one of the components (see below)
# FFTW_INCLUDE_DIRS ... fftw include directory paths
# FFTW_VERSION ... fftw version found
#
# The following variables will be checked by the function
# FFTW_USE_STATIC_LIBS ... if true, only static libraries are found, otherwise both static and shared.
Expand Down Expand Up @@ -394,10 +395,38 @@ endif()

set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )

# Deduce the version
execute_process(COMMAND fftw-wisdom-to-conf -V
RESULT_VARIABLE success
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr)
if (success EQUAL 0)
string(REGEX MATCH "FFTW *version *([0-9]+([.][0-9]+([.][0-9]+)?)?)"
_version ${stdout}
)
string(REPLACE " " ";" _version_list ${_version})
list(GET _version_list -1 FFTW_VERSION)
set(_version_list)
set(_version)
else()
message("Error running fftw-wisdom-to-conf. Could not determine FFTW version
Output:
${stdout}

Error:
${stderr}
")
set(FFTW_VERSION)
endif()
set(stdout)
set(stderr)
set(success)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(FFTW
REQUIRED_VARS FFTW_INCLUDE_DIRS
VERSION_VAR FFTW_VERSION
HANDLE_COMPONENTS
)

Expand All @@ -416,4 +445,5 @@ mark_as_advanced(
FFTW_FLOAT_MPI_LIB
FFTW_DOUBLE_MPI_LIB
FFTW_LONGDOUBLE_MPI_LIB
FFTW_VERSION
)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CMake module for finding FFTW 3 using find_package
Once added to your project, this module allows you to find FFTW libraries and headers using the CMake `find_package` command:

```cmake
find_package(FFTW [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )
find_package(FFTW [version] [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )
```

This module sets the following variables:
Expand All @@ -14,6 +14,7 @@ This module sets the following variables:
- `FFTW_LIBRARIES` ... full paths to all found fftw libraries
- `FFTW_[component]_LIB` ... full path to one of the components (see below)
- `FFTW_INCLUDE_DIRS` ... fftw include directory paths
- FFTW_VERSION ... fftw version found

The following variables will be checked by the module:
- `FFTW_USE_STATIC_LIBS` ... if true, only static libraries are found, otherwise both static and shared.
Expand Down