aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--cmake/common.cmake20
1 files changed, 14 insertions, 6 deletions
diff --git a/cmake/common.cmake b/cmake/common.cmake
index 2179a32..0d813fe 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -96,7 +96,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
function(_cc_best_practices_msvc target)
set(compile_options /MP /W4)
get_target_property(target_type "${target}" TYPE)
- if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
+ get_target_property(aliased "${target}" ALIASED_TARGET)
+ if(NOT target_type STREQUAL "INTERFACE_LIBRARY" AND NOT aliased)
target_compile_options("${target}" PRIVATE ${compile_options})
endif()
endfunction()
@@ -104,7 +105,8 @@ endfunction()
function(_cc_best_practices_gcc target)
set(compile_options -Wall -Wextra)
get_target_property(target_type "${target}" TYPE)
- if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
+ get_target_property(aliased "${target}" ALIASED_TARGET)
+ if(NOT target_type STREQUAL "INTERFACE_LIBRARY" AND NOT aliased)
target_compile_options("${target}" PRIVATE ${compile_options})
endif()
endfunction()
@@ -125,7 +127,10 @@ function(_cc_common_windows_definitions target)
if(target_type STREQUAL "INTERFACE_LIBRARY")
target_compile_definitions("${target}" INTERFACE ${compile_definitions})
else()
- target_compile_definitions("${target}" PRIVATE ${compile_definitions})
+ get_target_property(aliased "${target}" ALIASED_TARGET)
+ if(NOT aliased)
+ target_compile_definitions("${target}" PRIVATE ${compile_definitions})
+ endif()
endif()
endfunction()
@@ -133,7 +138,8 @@ endfunction()
function(_cc_static_runtime_msvc target)
get_target_property(target_type "${target}" TYPE)
- if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
+ get_target_property(aliased "${target}" ALIASED_TARGET)
+ if(NOT target_type STREQUAL "INTERFACE_LIBRARY" AND NOT aliased)
target_compile_options("${target}" PRIVATE
$<$<CONFIG:Debug>:/MTd>
$<$<NOT:$<CONFIG:Debug>>:/MT>)
@@ -142,7 +148,8 @@ endfunction()
function(_cc_static_runtime_gcc target)
get_target_property(target_type "${target}" TYPE)
- if(target_type STREQUAL "EXECUTABLE")
+ get_target_property(aliased "${target}" ALIASED_TARGET)
+ if(NOT target_type STREQUAL "INTERFACE_LIBRARY" AND NOT aliased)
# This causes issues with mixing keyword- and plain- versions of
# target_link_libraries:
#target_link_libraries("${target}" PRIVATE -static)
@@ -166,7 +173,8 @@ endfunction()
function(_cc_strip_symbols_gcc target)
get_target_property(target_type "${target}" TYPE)
- if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
+ get_target_property(aliased "${target}" ALIASED_TARGET)
+ if(NOT target_type STREQUAL "INTERFACE_LIBRARY" AND NOT aliased)
set(release_build $<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>>)
if(release_build)
# This causes issues with mixing keyword- and plain- versions of