commit ad05e2903cb599b00aee7e7177e1ce09b6ed1f4e
parent 534f44a8c4e63a3382f8244fcc250fa116f28552
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Sun, 28 Aug 2011 08:59:44 -0400
Cmake: fixing version/case bugs
- FFTW should now have the proper case for include directories
- find macros should now only assume the package is found if pkg-config tells it
so
Diffstat:
2 files changed, 39 insertions(+), 46 deletions(-)
diff --git a/cmake/Findfftw.cmake b/cmake/Findfftw.cmake
@@ -1,17 +1,17 @@
#Find fftw (FFT algorithm library)
include(LibFindMacros)
-libfind_pkg_check_modules(fftw fftw3)
-find_path(fftw_INCLUDE_DIR
+libfind_pkg_check_modules(FFTW fftw3)
+find_path(FFTW_INCLUDE_DIR
NAMES fftw3.h
- PATHS ${fftw_INCLUDE_DIRS}
+ PATHS ${FFTW_INCLUDE_DIRS}
)
-find_library(fftw_LIBRARY
+find_library(FFTW_LIBRARY
NAMES fftw3
- PATHS ${fftw_LIBRARY_DIRS}
+ PATHS ${FFTW_LIBRARY_DIRS}
)
-set(fftw_PROCESS_INCLUDES fftw_INCLUDE_DIR)
-set(fftw_PROCESS_LIBS fftw_LIBRARY)
-libfind_process(fftw)
+set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR)
+set(FFTW_PROCESS_LIBS FFTW_LIBRARY)
+libfind_process(FFTW)
diff --git a/cmake/LibFindMacros.cmake b/cmake/LibFindMacros.cmake
@@ -35,47 +35,40 @@ endmacro (libfind_pkg_check_modules)
# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
# Also handles errors in case library detection was required, etc.
-# Performs very basic version checks
macro (libfind_process PREFIX)
- # Skip processing if already processed during this run
- if (NOT ${PREFIX}_FOUND)
- # Start with the assumption that the library was found
- set (${PREFIX}_FOUND TRUE)
+ # Process all includes and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES})
+ if (${i})
+ set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
- # Process all includes and set _FOUND to false if any are missing
- foreach (i ${${PREFIX}_PROCESS_INCLUDES})
- if (${i})
- set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
- mark_as_advanced(${i})
- else (${i})
- set (${PREFIX}_FOUND FALSE)
- endif (${i})
- endforeach (i)
+ # Process all libraries and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_LIBS})
+ if (${i})
+ set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
- # Process all libraries and set _FOUND to false if any are missing
- foreach (i ${${PREFIX}_PROCESS_LIBS})
- if (${i})
- set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
- mark_as_advanced(${i})
- else (${i})
- set (${PREFIX}_FOUND FALSE)
- endif (${i})
- endforeach (i)
-
- # Print message and/or exit on fatal error
- if (${PREFIX}_FOUND)
- if (NOT ${PREFIX}_FIND_QUIETLY)
- message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
- endif (NOT ${PREFIX}_FIND_QUIETLY)
- else (${PREFIX}_FOUND)
- if (${PREFIX}_FIND_REQUIRED)
- foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
- message("${i}=${${i}}")
- endforeach (i)
- message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
- endif (${PREFIX}_FIND_REQUIRED)
- endif (${PREFIX}_FOUND)
- endif (NOT ${PREFIX}_FOUND)
+ # Print message and/or exit on fatal error
+ if (${PREFIX}_FOUND)
+ if (NOT ${PREFIX}_FIND_QUIETLY)
+ message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
+ endif (NOT ${PREFIX}_FIND_QUIETLY)
+ else (${PREFIX}_FOUND)
+ if (${PREFIX}_FIND_REQUIRED)
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
+ message("${i}=${${i}}")
+ endforeach (i)
+ message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
+ endif (${PREFIX}_FIND_REQUIRED)
+ endif (${PREFIX}_FOUND)
endmacro (libfind_process)
macro(libfind_library PREFIX basename)