| 1 |
# - Try to find FFTW3. |
| 2 |
# Usage: find_package(FFTW3 [COMPONENTS [single double long-double threads]]) |
| 3 |
# |
| 4 |
# Variables used by this module: |
| 5 |
# FFTW3_ROOT - FFTW3 root directory |
| 6 |
# Variables defined by this module: |
| 7 |
# FFTW3_FOUND - system has FFTW3 |
| 8 |
# FFTW3_INCLUDE_DIR - the FFTW3 include directory (cached) |
| 9 |
# FFTW3_INCLUDE_DIRS - the FFTW3 include directories |
| 10 |
# (identical to FFTW3_INCLUDE_DIR) |
| 11 |
# FFTW3[FL]?_LIBRARY - the FFTW3 library - double, single(F), |
| 12 |
# long-double(L) precision (cached) |
| 13 |
# FFTW3[FL]?_THREADS_LIBRARY - the threaded FFTW3 library - double, single(F), |
| 14 |
# long-double(L) precision (cached) |
| 15 |
# FFTW3_LIBRARIES - list of all FFTW3 libraries found |
| 16 |
|
| 17 |
# Copyright (C) 2009-2010 |
| 18 |
# ASTRON (Netherlands Institute for Radio Astronomy) |
| 19 |
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands |
| 20 |
# |
| 21 |
# This file is part of the LOFAR software suite. |
| 22 |
# The LOFAR software suite is free software: you can redistribute it and/or |
| 23 |
# modify it under the terms of the GNU General Public License as published |
| 24 |
# by the Free Software Foundation, either version 3 of the License, or |
| 25 |
# (at your option) any later version. |
| 26 |
# |
| 27 |
# The LOFAR software suite is distributed in the hope that it will be useful, |
| 28 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 29 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 30 |
# GNU General Public License for more details. |
| 31 |
# |
| 32 |
# You should have received a copy of the GNU General Public License along |
| 33 |
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. |
| 34 |
# |
| 35 |
# $Id: FindFFTW3.cmake 15918 2010-06-25 11:12:42Z loose $ |
| 36 |
|
| 37 |
# Use double precision by default. |
| 38 |
if(FFTW3_FIND_COMPONENTS MATCHES "^$") |
| 39 |
set(_components double) |
| 40 |
else() |
| 41 |
set(_components ${FFTW3_FIND_COMPONENTS}) |
| 42 |
endif() |
| 43 |
|
| 44 |
# Loop over each component. |
| 45 |
set(_libraries) |
| 46 |
foreach(_comp ${_components}) |
| 47 |
if(_comp STREQUAL "single") |
| 48 |
list(APPEND _libraries fftw3f) |
| 49 |
elseif(_comp STREQUAL "double") |
| 50 |
list(APPEND _libraries fftw3) |
| 51 |
elseif(_comp STREQUAL "long-double") |
| 52 |
list(APPEND _libraries fftw3l) |
| 53 |
elseif(_comp STREQUAL "threads") |
| 54 |
set(_use_threads ON) |
| 55 |
else(_comp STREQUAL "single") |
| 56 |
message(FATAL_ERROR "FindFFTW3: unknown component `${_comp}' specified. " |
| 57 |
"Valid components are `single', `double', `long-double', and `threads'.") |
| 58 |
endif(_comp STREQUAL "single") |
| 59 |
endforeach(_comp ${_components}) |
| 60 |
|
| 61 |
# If using threads, we need to link against threaded libraries as well. |
| 62 |
if(_use_threads) |
| 63 |
set(_thread_libs) |
| 64 |
foreach(_lib ${_libraries}) |
| 65 |
list(APPEND _thread_libs ${_lib}_threads) |
| 66 |
endforeach(_lib ${_libraries}) |
| 67 |
set(_libraries ${_thread_libs} ${_libraries}) |
| 68 |
endif(_use_threads) |
| 69 |
|
| 70 |
# Keep a list of variable names that we need to pass on to |
| 71 |
# find_package_handle_standard_args(). |
| 72 |
set(_check_list) |
| 73 |
|
| 74 |
# Search for all requested libraries. |
| 75 |
foreach(_lib ${_libraries}) |
| 76 |
string(TOUPPER ${_lib} _LIB) |
| 77 |
find_library(${_LIB}_LIBRARY ${_lib} |
| 78 |
HINTS ${FFTW3_ROOT} PATH_SUFFIXES lib) |
| 79 |
mark_as_advanced(${_LIB}_LIBRARY) |
| 80 |
list(APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY}) |
| 81 |
list(APPEND _check_list ${_LIB}_LIBRARY) |
| 82 |
endforeach(_lib ${_libraries}) |
| 83 |
|
| 84 |
# Search for the header file. |
| 85 |
find_path(FFTW3_INCLUDE_DIR fftw3.h |
| 86 |
HINTS ${FFTW3_ROOT} PATH_SUFFIXES include) |
| 87 |
mark_as_advanced(FFTW3_INCLUDE_DIR) |
| 88 |
list(APPEND _check_list FFTW3_INCLUDE_DIR) |
| 89 |
|
| 90 |
# Handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if |
| 91 |
# all listed variables are TRUE |
| 92 |
include(FindPackageHandleStandardArgs) |
| 93 |
find_package_handle_standard_args(FFTW3 DEFAULT_MSG ${_check_list}) |