diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-10 12:12:09 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-11 15:07:14 +0000 |
commit | 859b36ca143bd2955f97f167ede7f14029326f6c (patch) | |
tree | f25060fdb951d834407784cabd7ced59048a2ec4 /cmake | |
parent | f9676fdd91ae09a5e34baabcbef59d1580822740 (diff) |
CMake: Use imported target to create _nolink targets
Use an imported target to create _nolink targets. This gets rid of
the need to have an helper target that gets aliases to get work
around the problem of the original target might having a "::" in
its name.
Change-Id: I4618980cf2c673ebf5caca593bccf122b3c81480
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 5a323264e9..84769a4eb8 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -170,20 +170,18 @@ function(qt_create_nolink_target target) set(nolink_target "${target}_nolink") if(NOT TARGET "${nolink_target}") - string(REPLACE ":" "_" base_target "__${nolink_target}") - add_library("${base_target}" INTERFACE) - target_include_directories("${base_target}" INTERFACE - $<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>) - target_include_directories("${base_target}" INTERFACE SYSTEM - $<TARGET_PROPERTY:${target},INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>) - target_compile_definitions("${base_target}" INTERFACE - $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_DEFINITIONS>) - target_compile_options("${base_target}" INTERFACE - $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_OPTIONS>) - target_compile_features("${base_target}" INTERFACE - $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_FEATURES>) - - add_library("${nolink_target}" ALIAS "${base_target}") + add_library("${nolink_target}" INTERFACE IMPORTED) + set_target_properties("${nolink_target}" PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + $<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES> + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + $<TARGET_PROPERTY:${target},INTERFACE_SYSTEM_INCLUDE_DIRECTORIES> + INTERFACE_COMPILE_DEFINITIONS + $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_DEFINITIONS> + INTERFACE_COMPILE_OPTIONS + $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_OPTIONS> + INTERFACE_COMPILE_FEATURES + $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_FEATURES>) endif() endfunction() |