Fix shared libs for Mingw
[alexxy/gromacs.git] / cmake / gmxManageSharedLibraries.cmake
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.")