Skip to content

Instantly share code, notes, and snippets.

@eartle
Created May 22, 2012 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eartle/2768527 to your computer and use it in GitHub Desktop.
Save eartle/2768527 to your computer and use it in GitHub Desktop.
diff --git a/cmake/Modules/FindLibFFTW3.cmake b/cmake/Modules/FindLibFFTW3.cmake
index fa6419a..42aace6 100644
--- a/cmake/Modules/FindLibFFTW3.cmake
+++ b/cmake/Modules/FindLibFFTW3.cmake
@@ -9,12 +9,17 @@
# LIBFFTW3_INCLUDE_DIR The libfftw3 include directory
# LIBFFTW3_LIBRARY The libfftw3 librarys
+find_package(PkgConfig)
+pkg_check_modules(PC_FFTW3F QUIET fftw3f)
+set(FFTW3F_DEFINITIONS ${PC_FFTW3F_CFLAGS_OTHER})
+
if(NOT LIBFFTW3_PRECISION)
message(STATUS "Searching for LIBFFTW3, using default precision float")
set(LIBFFTW3_PRECISION FLOAT)
endif(NOT LIBFFTW3_PRECISION)
-find_path(LIBFFTW3_INCLUDE_DIR fftw3.h)
+find_path(LIBFFTW3_INCLUDE_DIR fftw3.h
+ HINTS ${PC_FFTW3F_INCLUDEDIR} ${PC_FFTW3F_INCLUDE_DIRS})
if(LIBFFTW3_PRECISION STREQUAL FLOAT)
set(LIBFFTW3_PRECISION_SUFFIX f)
@@ -28,7 +33,8 @@ if(LIBFFTW3_PRECISION STREQUAL LDOUBLE)
set(LIBFFTW3_PRECISION_SUFFIX l)
endif(LIBFFTW3_PRECISION STREQUAL LDOUBLE)
-find_library(LIBFFTW3_LIBRARY NAMES fftw3${LIBFFTW3_PRECISION_SUFFIX} libfftw3${LIBFFTW3_PRECISION_SUFFIX}-3 fftw3${LIBFFTW3_PRECISION_SUFFIX}-3)
+find_library(LIBFFTW3_LIBRARY NAMES fftw3${LIBFFTW3_PRECISION_SUFFIX} libfftw3${LIBFFTW3_PRECISION_SUFFIX}-3 fftw3${LIBFFTW3_PRECISION_SUFFIX}-3
+ HINTS ${PC_FFTW3F_LIBDIR} ${PC_FFTW3F_LIBRARY_DIRS})
if(FIND_LIBFFTW3_VERBOSE)
message(STATUS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment