Skip to content
Snippets Groups Projects
Unverified Commit d68e3d1e authored by Van Herck, Walter's avatar Van Herck, Walter Committed by GitHub
Browse files

Merge pull request #853 from gpospelov/develop

Simplify CMake search of fftw3
parents f83d37e9 13879125
No related branches found
No related tags found
No related merge requests found
# Find the FFTW includes and library. # Find the FFTW includes and library.
# #
# This module defines # This module defines
# FFTW_INCLUDE_DIR, where to locate fftw3.h file # FFTW_INCLUDE_DIR, where to locate fftw3.h file
# FFTW_LIBRARIES, the libraries to link against to use fftw3 # FFTW_LIBRARIES, the libraries to link against to use fftw3
# FFTW_FOUND. If false, you cannot build anything that requires fftw3.
# FFTW_LIBRARY, where to find the libfftw3 library. # FFTW_LIBRARY, where to find the libfftw3 library.
set(FFTW_FOUND 0) # --- Looking for headers -----
if(FFTW_LIBRARY AND FFTW_INCLUDE_DIR)
set(FFTW_FIND_QUIETLY TRUE) find_path(FFTW_INCLUDE_DIR fftw3.h)
if(NOT FFTW_INCLUDE_DIR)
message(ERROR " Missed dependency. Can't find FFTW headers, please make sure that you've installed FFTW development version.")
endif() endif()
if(NOT WIN32) # --- Looking for library -----
find_path(FFTW_INCLUDE_DIR fftw3.h
$ENV{FFTW_DIR}/include
$ENV{FFTW3} $ENV{FFTW3}/include $ENV{FFTW3}/api
/usr/local/include
/usr/include
/opt/fftw3/include
/opt/local/include
DOC "Specify the directory containing fftw3.h"
)
find_library(FFTW_LIBRARY NAMES fftw3 fftw3-3 PATHS set(FFTW_NAMES ${FFTW_NAMES} fftw3 fftw3-3 libfftw3-3)
$ENV{FFTW_DIR}/lib set( ba_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
$ENV{FFTW3} $ENV{FFTW3}/lib $ENV{FFTW3}/.libs
/usr/local/lib
/usr/lib
/opt/fftw3/lib
HINTS /opt/local/lib
DOC "Specify the fttw3 library here."
)
else()
find_path(FFTW_INCLUDE_DIR fftw3.h
HINTS ENV PATH
PATHS "C:/opt/local_x64/include" # if fftw cannot be found in env path
PATH_SUFFIXES ../include
NO_DEFAULT_PATH
)
# message("XXX ${FFTW_INCLUDE_DIR}")
find_library(FFTW_LIBRARY libfftw3-3 if (NOT APPLE AND NOT WIN32)
HINTS ENV PATH set(CMAKE_FIND_LIBRARY_SUFFIXES .so) # require shared version of library
PATHS "C:/opt/local_x64/lib" # if fftw cannot be found in env path endif()
NO_DEFAULT_PATH
)
find_library(FFTW_LIBRARY NAMES ${FFTW_NAMES} QUIET)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${ba_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
if (WIN31)
string( REPLACE ".lib" ".dll" FFTW_LIBRARY_DLL "${FFTW_LIBRARY}" ) string( REPLACE ".lib" ".dll" FFTW_LIBRARY_DLL "${FFTW_LIBRARY}" )
if (NOT EXISTS ${FFTW_LIBRARY_DLL}) if (NOT EXISTS ${FFTW_LIBRARY_DLL})
message(FATAL_ERROR "File ${FFTW_LIBRARY_DLL} does not exist") message(FATAL_ERROR "File ${FFTW_LIBRARY_DLL} does not exist")
endif (NOT EXISTS ${FFTW_LIBRARY_DLL}) endif(NOT EXISTS ${FFTW_LIBRARY_DLL})
endif() endif()
if(FFTW_INCLUDE_DIR AND FFTW_LIBRARY) # --- Processing variables -----
set(FFTW_FOUND 1 )
if(NOT FFTW_FIND_QUIETLY)
message(STATUS "Found fftw3 includes at ${FFTW_INCLUDE_DIR}")
message(STATUS "Found fftw3 library at ${FFTW_LIBRARY}")
endif()
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW REQUIRED_VARS FFTW_LIBRARY FFTW_INCLUDE_DIR)
if( NOT FFTW_FOUND ) if(FFTW_FOUND)
if( FFTW_FIND_REQUIRED ) set( FFTW_LIBRARIES ${FFTW_LIBRARY} )
message( FATAL_ERROR "FindFFTW: can't find fftw3 header or library" )
endif()
endif() endif()
if(FFTW_FOUND)
message(STATUS "Found FFTW: includes at ${FFTW_INCLUDE_DIR}, libraries at ${FFTW_LIBRARIES}")
else()
message(STATUS "Cant'f find fftw3 library: ${FFTW_INCLUDE_DIR}, ${FFTW_LIBRARIES}.")
if (NOT WIN32 AND NOT APPLE)
message(STATUS "Please note, that shared version of FFTW library is required (use enable-shared during configuration phase).")
endif()
endif()
set(FFTW_LIBRARIES ${FFTW_LIBRARY}) mark_as_advanced(FFTW_INCLUDE_DIR FFTW_LIBRARY FFTW_LIBRARY_DLL)
mark_as_advanced(FFTW_FOUND FFTW_LIBRARY FFTW_INCLUDE_DIR FFTW_LIBRARY_DLL)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment