tFindFFTW.cmake - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
 (HTM) git clone git://src.adamsgaard.dk/pism
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tFindFFTW.cmake (1379B)
       ---
            1 # - Find FFTW
            2 # Find the native FFTW includes and library
            3 #
            4 #  FFTW_INCLUDES    - where to find fftw3.h
            5 #  FFTW_LIBRARIES   - List of libraries when using FFTW.
            6 #  FFTW_FOUND       - True if FFTW found.
            7 
            8 if (FFTW_INCLUDES)
            9   # Already in cache, be silent
           10   set (FFTW_FIND_QUIETLY TRUE)
           11 endif (FFTW_INCLUDES)
           12 
           13 find_path (FFTW_INCLUDES fftw3.h
           14   HINTS "${FFTW_ROOT}/include" "$ENV{FFTW_ROOT}/include")
           15 
           16 string(REGEX REPLACE "/include/?$" "/lib"
           17   FFTW_LIB_HINT ${FFTW_INCLUDES})
           18 
           19 find_library (FFTW_LIBRARIES
           20   NAMES fftw3
           21   HINTS ${FFTW_LIB_HINT})
           22 
           23 if ((NOT FFTW_LIBRARIES) OR (NOT FFTW_INCLUDES))
           24   message(STATUS "Trying to find FFTW3 using LD_LIBRARY_PATH (we're desperate)...")
           25 
           26   file(TO_CMAKE_PATH "$ENV{LD_LIBRARY_PATH}" LD_LIBRARY_PATH)
           27 
           28   find_library(FFTW_LIBRARIES
           29     NAMES fftw3
           30     HINTS ${LD_LIBRARY_PATH})
           31 
           32   if (FFTW_LIBRARIES)
           33     get_filename_component(FFTW_LIB_DIR ${FFTW_LIBRARIES} PATH)
           34     string(REGEX REPLACE "/lib/?$" "/include"
           35       FFTW_H_HINT ${FFTW_LIB_DIR})
           36 
           37     find_path (FFTW_INCLUDES fftw3.h
           38       HINTS ${FFTW_H_HINT}
           39       DOC "Path to fftw3.h")
           40   endif()
           41 endif()
           42 
           43 # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
           44 # all listed variables are TRUE
           45 include (FindPackageHandleStandardArgs)
           46 find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDES)
           47 
           48 mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES)