changeset 22:b42eeb4bd1e3

fix mingw build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 May 2015 11:07:38 +0200
parents 8ff9507fac17
children 7a0af291cc90
files Resources/CMake/Compiler.cmake
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Mon Apr 27 12:16:34 2015 +0200
+++ b/Resources/CMake/Compiler.cmake	Fri May 29 11:07:38 2015 +0200
@@ -31,6 +31,10 @@
   if (CMAKE_COMPILER_IS_GNUCXX)
     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
     SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+
+    # This line is necessary to compile with recent versions of MinGW,
+    # otherwise "libwinpthread-1.dll" is not statically linked.
+    SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
   endif()
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
   SET(OS_LIBRARIES uuid)