From 859b36ca143bd2955f97f167ede7f14029326f6c Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 10 Apr 2019 12:12:09 +0200 Subject: 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 --- cmake/QtBuild.cmake | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'cmake') 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_include_directories("${base_target}" INTERFACE SYSTEM - $) - target_compile_definitions("${base_target}" INTERFACE - $) - target_compile_options("${base_target}" INTERFACE - $) - target_compile_features("${base_target}" INTERFACE - $) - - add_library("${nolink_target}" ALIAS "${base_target}") + add_library("${nolink_target}" INTERFACE IMPORTED) + set_target_properties("${nolink_target}" PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + $ + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + $ + INTERFACE_COMPILE_DEFINITIONS + $ + INTERFACE_COMPILE_OPTIONS + $ + INTERFACE_COMPILE_FEATURES + $) endif() endfunction() -- cgit v1.2.3