From 3f9ef46bc51acc5933721974e191d2a9659f6566 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 19 Dec 2014 14:52:57 -0800 Subject: Added support for MinGW cross-compile * Added CMake toolchain file, compatible with different versions * No dependency on MinGW runtime, all statically linked * Misc coding tweaks to allow MinGW to compile --- host/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'host/CMakeLists.txt') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 856f1ec70..6d87bf95d 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -137,6 +137,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) -- cgit v1.2.3