Fix MKL linking
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 6 Mar 2014 17:42:31 +0000 (18:42 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 11 Mar 2014 12:09:48 +0000 (13:09 +0100)
Setting the same for CMAKE_STATIC_LINKER_FLAGS broke because that
variable got applied to calls to ar for linking libgmock.a. Probably
not important because Intel probably encourages shared linking for
MKL.

Change-Id: I6816d8ba318c704a0efad7659f5afecaeb48b092

CMakeLists.txt
cmake/gmxManageFFTLibraries.cmake
cmake/gmxManageLinearAlgebraLibraries.cmake

index 4500c7eb5573f697ef36cf87628a16400444f586..2c0482094602b215654e54d40c11e8e9adb90d01 100644 (file)
@@ -725,7 +725,7 @@ if (NOT GMX_SKIP_DEFAULT_CFLAGS)
     set(CMAKE_C_FLAGS "${SIMD_C_FLAGS} ${MPI_COMPILE_FLAGS} ${EXTRA_C_FLAGS} ${CMAKE_C_FLAGS}")
     set(CMAKE_CXX_FLAGS "${SIMD_CXX_FLAGS} ${MPI_COMPILE_FLAGS} ${EXTRA_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${FFT_LINKER_FLAGS} ${MPI_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
-    set(CMAKE_SHARED_LINKER_FLAGS "${MPI_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
+    set(CMAKE_SHARED_LINKER_FLAGS "${FFT_LINKER_FLAGS} ${MPI_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}")
 else()
     message("Recommended flags which are not added because GMX_SKIP_DEFAULT_CFLAGS=yes:")
     message("CMAKE_C_FLAGS: ${SIMD_C_FLAGS} ${MPI_COMPILE_FLAGS} ${EXTRA_C_FLAGS} ${GMXC_CFLAGS}")
index 35c600001ee7ca404e8a24d6b40f71dbcc9a9ae1..3edd654a0ebf280d8571ce431d337e5cf9218510 100644 (file)
@@ -98,7 +98,10 @@ elseif(${GMX_FFT_LIBRARY} STREQUAL "MKL")
     if (NOT MKL_MANUALLY)
         # The next line takes care of everything for MKL
         if (WIN32)
-            set(FFT_LINKER_FLAGS "/Qmkl=sequential")
+            # This works according to the Intel MKL 10.3 for Windows
+            # docs, but on Jenkins Win2k8, icl tries to interpret it
+            # as a file. Shrug.
+            set(FFT_LINKER_FLAGS "/Qmkl:sequential")
         else()
             set(FFT_LINKER_FLAGS "-mkl=sequential")
         endif()
index bcbc8bab5704a984046d0db6713d9ec591d946c3..fb723187da53f79d2aad5ac504c0913f8c6bb415 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013, by the GROMACS development team, led by
+# Copyright (c) 2013,2014, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -85,7 +85,8 @@ macro(manage_linear_algebra_library name function_in_library)
         endif()
 
         if(NOT _library_was_found AND HAVE_LIBMKL)
-            set(CMAKE_REQUIRED_LIBRARIES ${FFT_LINKER_FLAGS} ${FFT_LIBRARIES})
+            set(CMAKE_REQUIRED_LIBRARIES "${FFT_LIBRARIES}")
+            set(CMAKE_REQUIRED_FLAGS "${FFT_LINKER_FLAGS}")
             # This may also not work correctly if the user changes
             # MKL_LIBRARIES after the first run. However,
             # MKL_LIBRARIES is only needed for icc version < 11, or