Fix shared libs for Mingw
authorRoland Schulz <roland@utk.edu>
Fri, 5 Sep 2014 08:28:07 +0000 (04:28 -0400)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 17 Sep 2014 22:35:07 +0000 (00:35 +0200)
Change-Id: Ib25e6b2a34080632e1d531da3194680cc8c6825b

cmake/gmxManageSharedLibraries.cmake
src/gromacs/CMakeLists.txt

index fced521e952c7c254a6ae553b181c617a8385992..0cfab0ce68c2c876b9b810c9961a6f0fbba7e781 100644 (file)
@@ -118,7 +118,11 @@ IF( WIN32 AND NOT CYGWIN)
           message(WARNING "Shared system libraries requested, and static Gromacs libraries requested.")
       endif()
   else()
-      message(FATAL_ERROR "BUILD_SHARED_LIBS=ON not yet working for Windows in the master branch")
+      if(MINGW)
+          set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols ${CMAKE_SHARED_LINKER_FLAGS}")
+      else()
+          message(FATAL_ERROR "BUILD_SHARED_LIBS=ON not yet working for Windows in the master branch")
+      endif()
       if(GMX_PREFER_STATIC_LIBS)
           #this combination segfaults (illegal passing of file handles)
           message(FATAL_ERROR "Static system libraries requested, and shared Gromacs libraries requested.")
index 1bffd962de904aafbce5595bc1f0697ddf9dc1bc..6db37e2402e57b5ead038c6f4fe53bdebb24c2f1 100644 (file)
@@ -199,7 +199,11 @@ set_target_properties(libgromacs PROPERTIES
 # Only install the library in mdrun-only mode if it is actually necessary
 # for the binary
 if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
-    install(TARGETS libgromacs DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
+    install(TARGETS libgromacs
+        LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+        RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+        ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+        COMPONENT libraries)
 endif()
 
 if (NOT GMX_BUILD_MDRUN_ONLY)