aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-03 15:42:58 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-03 16:02:03 +0300
commit864fe9e88734339852f26dc634e9d705c43135ea (patch)
treef30e7d879d8345ab99b679f14eee861f3e20185f
parentci/build.py: split -D from its argument (diff)
downloadcmake-common-864fe9e88734339852f26dc634e9d705c43135ea.tar.gz
cmake-common-864fe9e88734339852f26dc634e9d705c43135ea.zip
common.cmake: don't use keyword- target_link_libraries
Diffstat (limited to '')
-rw-r--r--common.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/common.cmake b/common.cmake
index 9a31acc..447f340 100644
--- a/common.cmake
+++ b/common.cmake
@@ -138,7 +138,14 @@ endfunction()
function(_cc_static_runtime_gcc target)
get_target_property(target_type "${target}" TYPE)
if(target_type STREQUAL "EXECUTABLE")
- target_link_libraries("${target}" PRIVATE -static)
+ # This causes issues with mixing keyword- and plain- versions of
+ # target_link_libraries:
+ #target_link_libraries("${target}" PRIVATE -static)
+
+ set_property(TARGET "${target}" APPEND_STRING PROPERTY LINK_FLAGS " -static")
+
+ # Or (haven't tested this), if CMake 3.13+ is used:
+ #target_link_options("${target}" PRIVATE -static)
endif()
endfunction()
@@ -156,7 +163,13 @@ function(_cc_strip_symbols_gcc target)
get_target_property(target_type "${target}" TYPE)
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
set(release_build $<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>)
- target_link_libraries("${target}" PRIVATE $<${release_build}:-s>)
+ if(release_build)
+ # This causes issues with mixing keyword- and plain- versions of
+ # target_link_libraries:
+ #target_link_libraries("${target}" PRIVATE -s)
+
+ set_property(TARGET "${target}" APPEND_STRING PROPERTY LINK_FLAGS " -s")
+ endif()
endif()
endfunction()