diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2014-12-19 14:52:57 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-01-13 09:46:41 +0100 |
commit | 3f9ef46bc51acc5933721974e191d2a9659f6566 (patch) | |
tree | 9dc0b36ab3f9f70ce0a7d0629e1a56aa2b41aed1 /host/CMakeLists.txt | |
parent | be5f9613311d944b8971570bff444c5af094f0f5 (diff) | |
download | uhd-3f9ef46bc51acc5933721974e191d2a9659f6566.tar.gz uhd-3f9ef46bc51acc5933721974e191d2a9659f6566.tar.bz2 uhd-3f9ef46bc51acc5933721974e191d2a9659f6566.zip |
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
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r-- | host/CMakeLists.txt | 16 |
1 files changed, 16 insertions, 0 deletions
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) |