|
|
1 год назад | |
|---|---|---|
| .. | ||
| FindFFTW.cmake | 1 год назад | |
| README.md | 1 год назад | |
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:
find_package(FFTW [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] )
This module sets the following variables:
FFTW_FOUND ... true if fftw is found on the systemFFTW_[component]_LIB_FOUND ... true if the component is found on the system (see components below)FFTW_LIBRARIES ... full paths to all found fftw librariesFFTW_[component]_LIB ... full path to one of the components (see below)FFTW_INCLUDE_DIRS ... fftw include directory pathsThe following variables will be checked by the module:
FFTW_USE_STATIC_LIBS ... if true, only static libraries are found, otherwise both static and shared.FFTW_ROOT ... if set, the libraries are exclusively searched under this path.This package supports the following components:
FLOAT_LIBDOUBLE_LIBLONGDOUBLE_LIBFLOAT_THREADS_LIBDOUBLE_THREADS_LIBLONGDOUBLE_THREADS_LIBFLOAT_OPENMP_LIBDOUBLE_OPENMP_LIBLONGDOUBLE_OPENMP_LIBFLOAT_MPI_LIBDOUBLE_MPI_LIBLONGDOUBLE_MPI_LIBand the following linking targets
FFTW::FloatFFTW::DoubleFFTW::LongDoubleFFTW::FloatThreadsFFTW::DoubleThreadsFFTW::LongDoubleThreadsFFTW::FloatOpenMPFFTW::DoubleOpenMPFFTW::LongDoubleOpenMPFFTW::FloatMPIFFTW::DoubleMPIFFTW::LongDoubleMPICopy the following into the CMakeLists.txt file of the project you want to use FindFFTW in:
configure_file(downloadFindFFTW.cmake.in findFFTW-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findFFTW-download )
if(result)
message(FATAL_ERROR "CMake step for findFFTW failed: ${result}")
else()
message("CMake step for findFFTW completed (${result}).")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findFFTW-download )
if(result)
message(FATAL_ERROR "Build step for findFFTW failed: ${result}")
endif()
set(findFFTW_DIR ${CMAKE_CURRENT_BINARY_DIR}/findFFTW-src)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${findFFTW_DIR}")
And add a file called downloadFindFFTW.cmake.in to your project containing the following:
cmake_minimum_required(VERSION 2.8.2)
project(findFFTW-download NONE)
include(ExternalProject)
ExternalProject_Add(findFFTW_download
GIT_REPOSITORY "https://github.com/egpbos/findfftw.git"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/findFFTW-src"
BINARY_DIR ""
INSTALL_DIR ""
)
After this, find_package(FFTW) can be used in the CMakeLists.txt file.
Clone the repository into directory PREFIX/findFFTW:
git clone https://github.com/egpbos/findfftw.git PREFIX/findFFTW
Then add the following to your CMakeLists.txt to allow CMake to find the module:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "PREFIX/findFFTW")