Reordered FFTW fatal error; avoids using unset variables
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 9 Aug 2013 14:44:11 +0000 (16:44 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 9 Aug 2013 14:51:58 +0000 (16:51 +0200)
Now variables that are set in FFTW detection are only used when the
variable that reports FFTW has been found is set (i.e. there has not
been a fatal error). Not sure why we haven't seen problems with this
so far, but we do see them on Power7 with cmake 2.8.8 when FFTWF is
not available.

Change-Id: I1a3e84002dda7f29f90eb532ab14ce51dfca6e5c

CMakeLists.txt

index 4274e2d9cb506c857022e309f66a1ef059da7510..29cb127eb830844f048b488244e8c671bac77098 100644 (file)
@@ -942,15 +942,14 @@ if(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
     else()
       find_package(FFTW COMPONENTS ${FFTW})
     endif()
+    if(NOT ${FFTW}_FOUND)
+      MESSAGE(FATAL_ERROR "Cannot find FFTW 3 (with correct precision - libfftw3f for single-precision GROMACS or libfftw3 for double-precision GROMACS). Either choose the right precision, choose another FFT(W) library (-DGMX_FFT_LIBRARY), enable the advanced option to let GROMACS build FFTW 3 for you (-DGMX_BUILD_OWN_FFTW=ON) , or use the really slow GROMACS built-in fftpack library (-DGMX_FFT_LIBRARY=fftpack).")
+    endif()
 
     string(TOUPPER "${FFTW}" FFTW)
     set(PKG_FFT "${${FFTW}_PKG}")
     include_directories(${${FFTW}_INCLUDE_DIRS})
     set(FFT_LIBRARIES ${${FFTW}_LIBRARIES})
-    if(NOT ${FFTW}_FOUND)
-      MESSAGE(FATAL_ERROR "Cannot find FFTW 3 (with correct precision - libfftw3f for single-precision GROMACS or libfftw3 for double-precision GROMACS). Either choose the right precision, choose another FFT(W) library (-DGMX_FFT_LIBRARY), enable the advanced option to let GROMACS build FFTW 3 for you (-DGMX_BUILD_OWN_FFTW=ON) , or use the really slow GROMACS built-in fftpack library (-DGMX_FFT_LIBRARY=fftpack).")
-    endif()
-
     set(GMX_FFT_FFTW3 1)
 
     if ((${GMX_CPU_ACCELERATION} MATCHES "SSE" OR ${GMX_CPU_ACCELERATION} MATCHES "AVX") AND NOT ${FFTW}_HAVE_SIMD)