Don't cache ${FFTW}_HAVE_(SIMD|AVX)
authorRoland Schulz <roland@utk.edu>
Mon, 14 Jan 2013 06:38:05 +0000 (01:38 -0500)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 16 Jan 2013 01:16:02 +0000 (02:16 +0100)
The error message was incorrect if the library was changed. E.g.
if the library wasn't found on the first try and then (e.g. with
CMAKE_PREFIX_PATH) was found on the 2nd try. Could have been
resolved by using FORCE when setting variables, but that would
have defeated the purpose of allowing the user to overwrite
the value for future versions which might be misidentified.
Any solution which lets the user to overwrite but still works
correctly if the library changes would be difficult. Given that
it is only for displaying a warning message, it is not worth
making it much more complicated.

Change-Id: I0b6c5a204ee0114ef9de9337491a14457917f9d7

cmake/FindFFTW.cmake

index f9053cee9b9e081e5b9bf8d721853dd254a6bb0c..6d1b67de71440f3608fb1e88934292915e911a0a 100644 (file)
@@ -109,7 +109,7 @@ if (${FFTW}_FOUND)
   foreach(AVX_FUNCTION ${${FFTW}_FUNCTION_PREFIX}_have_simd_avx)
     check_library_exists("${${FFTW}_LIBRARIES}" "${AVX_FUNCTION}" "" ${FFTW}_HAVE_${AVX_FUNCTION})
     if(${FFTW}_HAVE_${AVX_FUNCTION})
-      set(${FFTW}_HAVE_AVX TRUE CACHE BOOL "If ${${FFTW}_PKG} was built with AVX support")
+      set(${FFTW}_HAVE_AVX TRUE)
       break()
     endif(${FFTW}_HAVE_${AVX_FUNCTION})
   endforeach()
@@ -118,7 +118,7 @@ if (${FFTW}_FOUND)
   foreach(SIMD_FCT ${${FFTW}_FUNCTION_PREFIX}_have_simd_sse2;${${FFTW}_FUNCTION_PREFIX}_have_simd_avx;${${FFTW}_FUNCTION_PREFIX}_have_simd_altivec;${${FFTW}_FUNCTION_PREFIX}_have_simd_neon;${${FFTW}_FUNCTION_PREFIX}_have_sse2;${${FFTW}_FUNCTION_PREFIX}_have_sse;${${FFTW}_FUNCTION_PREFIX}_have_altivec)
     check_library_exists("${${FFTW}_LIBRARIES}" "${SIMD_FCT}" "" ${FFTW}_HAVE_${SIMD_FCT})
     if(${FFTW}_HAVE_${SIMD_FCT})
-      set(${FFTW}_HAVE_SIMD TRUE CACHE  BOOL "If ${${FFTW}_PKG} was built with SIMD support")
+      set(${FFTW}_HAVE_SIMD TRUE)
       break()
     endif(${FFTW}_HAVE_${SIMD_FCT})
   endforeach()
@@ -132,6 +132,5 @@ if (${FFTW}_FOUND)
   endif ()
   set(CMAKE_REQUIRED_LIBRARIES)
 endif (${FFTW}_FOUND)
-set(${FFTW}_HAVE_SIMD FALSE CACHE BOOL "If ${${FFTW}_PKG} was built with SIMD support")
 
-mark_as_advanced(${FFTW}_INCLUDE_DIR ${FFTW}_LIBRARY ${FFTW}_HAVE_SIMD ${FFTW}_HAVE_AVX)
+mark_as_advanced(${FFTW}_INCLUDE_DIR ${FFTW}_LIBRARY)