if(NOT PC_${FFTW}_FOUND)
message(STATUS "pkg-config could not detect ${${FFTW}_PKG}, trying generic detection")
endif()
-endif(NOT __pkg_config_checked_PC_${FFTW} OR NOT ${FFTW}_LIBRARY)
+endif()
find_path(${FFTW}_INCLUDE_DIR "fftw3.h" HINTS ${PC_${FFTW}_INCLUDE_DIRS})
find_library(${FFTW}_LIBRARY NAMES "${${FFTW}_PKG}" HINTS ${PC_${FFTW}_LIBRARY_DIRS})
if (HAVE_LIBM)
#adding MATH_LIBRARIES here to allow static libs, this does not harm us as we are anyway using it
set(CMAKE_REQUIRED_LIBRARIES m)
- endif (HAVE_LIBM)
+ endif ()
gmx_check_if_changed(FFTW_LIBRARY_CHANGED ${FFTW}_LIBRARIES)
if (FFTW_LIBRARY_CHANGED)
unset(FOUND_${FFTW}_PLAN CACHE)
check_library_exists("${${FFTW}_LIBRARIES}" "${${FFTW}_FUNCTION_PREFIX}_plan_r2r_1d" "" FOUND_${FFTW}_PLAN)
if(NOT FOUND_${FFTW}_PLAN)
message(FATAL_ERROR "Could not find ${${FFTW}_FUNCTION_PREFIX}_plan_r2r_1d in ${${FFTW}_LIBRARY}, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what went wrong. If you are using a static lib (.a) make sure you have specified all dependencies of ${${FFTW}_PKG} in ${FFTW}_LIBRARY by hand (e.g. -D${FFTW}_LIBRARY='/path/to/lib${${FFTW}_PKG}.so;/path/to/libm.so') !")
- endif(NOT FOUND_${FFTW}_PLAN)
+ endif()
# Check for FFTW3 compiled with --enable-avx, which is slower for GROMACS than --enable-sse or --enable-sse2
foreach(AVX_FUNCTION ${${FFTW}_FUNCTION_PREFIX}_have_simd_avx)
if(${FFTW}_HAVE_${AVX_FUNCTION})
set(${FFTW}_HAVE_AVX TRUE)
break()
- endif(${FFTW}_HAVE_${AVX_FUNCTION})
+ endif()
endforeach()
#in 3.3 sse function name has changed
if(${FFTW}_HAVE_${SIMD_FCT})
set(${FFTW}_HAVE_SIMD TRUE)
break()
- endif(${FFTW}_HAVE_${SIMD_FCT})
+ endif()
endforeach()
#Verify FFTW is compiled with fPIC (necessary for shared libraries)
if (CMAKE_OBJDUMP AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND BUILD_SHARED_LIBS)
if (${${FFTW}_OBJDUMP} MATCHES "R_X86_64" #Should always be true for static libraries. Checks that objdump works properly and that the library isn't dynamic
AND NOT ${${FFTW}_OBJDUMP} MATCHES "R_X86_64_PLT32")
message(FATAL_ERROR "The FFTW library ${${FFTW}_LIBRARY} cannot be used with shared libraries. Provide a different FFTW library by setting ${FFTW}_LIBRARY. If you don't have a different one, recompile FFTW with \"--enable-shared\" or \"--with-pic\". Or disable shared libraries for Gromacs by setting BUILD_SHARED_LIBS to \"no\". Note: Disabling shared libraries requires up to 10x as much disk space.")
- endif ()
- endif ()
+ endif()
+ endif()
set(CMAKE_REQUIRED_LIBRARIES)
-endif (${FFTW}_FOUND)
+endif ()
mark_as_advanced(${FFTW}_INCLUDE_DIR ${FFTW}_LIBRARY)