also preferentiate .lib with GMX_PREFER_STATIC_LIBS
authorSzilard Pall <pszilard@cbr.su.se>
Thu, 8 Nov 2012 19:30:18 +0000 (20:30 +0100)
committerSzilard Pall <pszilard@cbr.su.se>
Fri, 9 Nov 2012 00:07:17 +0000 (01:07 +0100)
On Mac OS X GMX_PREFER_STATIC_LIBS was enabled by caca171. On Mac OS X
.lib is also used as suffix for static archives (as well as .a), this
commits adds .lib to the preferred library suffixes.

Change-Id: I39e8df212355f6b199de4f93abd29275babdfe96

CMakeLists.txt

index e3a9c41eec45d658bb9e98512ddd53cbd3143806..3579113f6c551b8dafc4e8e25b77ed7101706404 100644 (file)
@@ -200,7 +200,7 @@ mark_as_advanced(USE_VERSION_H)
 option(GMX_DEFAULT_SUFFIX "Use default suffixes for GROMACS binaries and libs (_d for double, _mpi for MPI; rerun cmake after changing to see relevant options)" ON)
 
 if(UNIX)
-    option(GMX_PREFER_STATIC_LIBS "When finding libraries prefer \".a\" static archives (NOTE: this is enabled only for UNIX platforms but it might not always work!" OFF)
+    option(GMX_PREFER_STATIC_LIBS "When finding libraries prefer static archives (not available on non-*nix platforms and it will only work if static versions of external dependencies are available and found)!" OFF)
     mark_as_advanced(GMX_PREFER_STATIC_LIBS)
 endif()
 
@@ -473,7 +473,9 @@ test_big_endian(GMX_INTEGER_BIG_ENDIAN)
 ########################################################################
 if(UNIX)
     if(GMX_PREFER_STATIC_LIBS)
-        SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        # On Linux .a is the static library suffix, on Mac OS X .lib can also
+        # be used, so we'll add both to the preference list.
+        SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
         if(SHARED_LIBS_DEFAULT)
             if(BUILD_SHARED_LIBS) #Warn the user about the combination. But don't overwrite the request.
                 message(WARNING "Static libraries requested, and shared Gromacs libraries requested.")