aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2012-03-09 17:01:22 +0000
committerJosé Fonseca <jfonseca@vmware.com>2012-03-09 17:14:48 +0000
commit279c6b5ad931313d60db975da31102558a602a21 (patch)
treeb4df55094774b5a269666790bc906187a3938f94 /CMakeLists.txt
parent79768543bdc804f0198646033b8e37d65811d729 (diff)
downloadpiglit-279c6b5ad931313d60db975da31102558a602a21.tar.gz
cmake: Avoid depending on MinGW runtime DLLs.
It makes the binaries easier to deploy. Tested-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47c8b3fe..3d7bf35b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,22 @@ else ()
add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif ()
+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 (WIN32)
# MSVC & MinGW only define & use APIENTRY
add_definitions (-DGLAPIENTRY=__stdcall)