Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[windows] request mingw-gcc to put the content of libgcc_s_seh-1.dll statically in...
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 1 Oct 2015 19:41:32 +0000 (21:41 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 1 Oct 2015 19:41:32 +0000 (21:41 +0200)
tools/cmake/GCCFlags.cmake

index 4bc9996..6b41adf 100644 (file)
@@ -167,3 +167,13 @@ if(NOT $ENV{LDFLAGS} STREQUAL "")
   message(STATUS "Add LDFLAGS: \"$ENV{LDFLAGS}\" to CMAKE_C_LINK_FLAGS")
   set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} $ENV{LDFLAGS}")
 endif()
+
+# We don't want to ship libgcc_s_seh-1.dll nor libstdc++-6.dll
+#  This will probably be troublesome if someone wants to use the lib in
+#  its own project, but we only want to have java working on Windows.
+if(MINGW)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
+  set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
+  set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
+endif()