aboutsummaryrefslogtreecommitdiffstats
path: root/host/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r--host/CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 67a824c8f..2245cd755 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -138,6 +138,22 @@ IF(MSVC)
ADD_DEFINITIONS(/MP) #multi-threaded build
ENDIF(MSVC)
+IF(MINGW)
+ #Avoid depending on MinGW runtime DLLs
+ CHECK_CXX_COMPILER_FLAG(-static-libgcc HAVE_STATIC_LIBGCC_FLAG)
+ IF(HAVE_STATIC_LIBGCC_FLAG)
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libgcc")
+ ENDIF()
+ CHECK_CXX_COMPILER_FLAG(-static-libstdc++ HAVE_STATIC_LIBSTDCXX_FLAG)
+ IF(HAVE_STATIC_LIBSTDCXX_FLAG)
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libstdc++")
+ ENDIF()
+ENDIF()
+
IF(CYGWIN)
ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this
ENDIF(CYGWIN)