summaryrefslogtreecommitdiff
path: root/Modules/CMakeCCompiler.cmake.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-30 13:42:50 -0400
committerBrad King <brad.king@kitware.com>2015-09-30 15:01:23 -0400
commit8b4873a1b025d7f47c90f3cafc93ca152b9e4652 (patch)
treebfbccc8785c7852687be5a6fafcde4dd9707805b /Modules/CMakeCCompiler.cmake.in
parente90f463a312e18fd6498799de1522b96d84fd012 (diff)
downloadcmake-8b4873a1b025d7f47c90f3cafc93ca152b9e4652.tar.gz
Disable shared library support when compiler links statically
When a user or a compiler wrapper adds '-static' to the compiler flags then it will always link static binaries. Detect this from the compiler id binary and disable TARGET_SUPPORTS_SHARED_LIBS. This will prevent projects from accidentally adding shared libraries when the toolchain does not support them. It also helps CMake avoid linking with flags that require shared libraries to be supported.
Diffstat (limited to 'Modules/CMakeCCompiler.cmake.in')
-rw-r--r--Modules/CMakeCCompiler.cmake.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index c72e3381f8..a1bfc70a00 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -2,6 +2,7 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
+set(CMAKE_C_COMPILER_LINKS_STATICALLY "@CMAKE_C_COMPILER_LINKS_STATICALLY@")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")