fixed/improved cmake FFTW3 detection
authorSzilard Pall <pszilard@cbr.su.se>
Tue, 31 Aug 2010 15:18:24 +0000 (17:18 +0200)
committerSzilard Pall <pszilard@cbr.su.se>
Tue, 31 Aug 2010 15:18:24 +0000 (17:18 +0200)
cmake/FindFFTW3.cmake
cmake/FindFFTW3F.cmake

index 636a96ec50678797f9ecdb79ad42fc2cc2bb5d11..616bbbf854fb4c03c2c32ce68ebd07827b88102a 100644 (file)
@@ -10,9 +10,15 @@ if (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
   set (FFTW3_FIND_QUIETLY TRUE)
 endif (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
 
-find_path (FFTW3_INCLUDE_DIR fftw3.h)
+find_path (FFTW3_INCLUDE_DIR fftw3.h
+               CACHE STRING "Path to headers for double precision FFTW3")
+
+
+find_library (FFTW3_LIBRARIES 
+               NAMES fftw3
+               PATHS "${FFTW3_INCLUDE_DIR}/../lib"
+               CACHE STRING "Double precision FFTW3 libraries")
 
-find_library (FFTW3_LIBRARIES NAMES fftw3)
 
 # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
 # all listed variables are TRUE
index 5ca2fc3e30be5870c79714d2debf6729b858df5f..23050153ad1d39f04a70c013b62b79601ab21c00 100644 (file)
@@ -5,14 +5,18 @@
 #  FFTW3F_LIBRARIES   - List of libraries when using FFTW.
 #  FFTW3F_FOUND       - True if FFTW found.
 
-if (FFTW3F_INCLUDE_DIR)
+if (FFTW3F_INCLUDE_DIR AND FFTW3F_LIBRARIES)
   # Already in cache, be silent
   set (FFTW3F_FIND_QUIETLY TRUE)
-endif (FFTW3F_INCLUDE_DIR)
+endif (FFTW3F_INCLUDE_DIR AND FFTW3F_LIBRARIES)
 
-find_path (FFTW3F_INCLUDE_DIR fftw3.h)
+find_path (FFTW3F_INCLUDE_DIR fftw3.h 
+       CACHE STRING "Path to headers for single precision FFTW3")
 
-find_library (FFTW3F_LIBRARIES NAMES fftw3f)
+find_library (FFTW3F_LIBRARIES 
+               NAMES fftw3f
+               PATHS "${FFTW3F_INCLUDE_DIR}/../lib"
+               CACHE STRING "Single precision FFTW3 libraries")
 
 # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
 # all listed variables are TRUE