summaryrefslogtreecommitdiffstats
path: root/cmake/QtTargetHelpers.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-11-16 16:53:15 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-11-19 06:28:41 +0100
commit5533eeeb0110c00a9658d5d3ceba6f882bf9cea1 (patch)
tree7b14149886a398b2a32a2a40e95c4113c51a8794 /cmake/QtTargetHelpers.cmake
parente0d709d8d3535a897de359eb9a0f33867b5ae040 (diff)
CMake: Refactor parts of qt_internal_walk_libs
Refactor the function in preparation of processing rcc object files. Introduce 2 new functions to get and set values in the memoization dictionary used by qt_internal_walk_libs. Modify qt_internal_add_target_aliases to assign the alias names it creates as properties on the target. Extract these aliases when available to assign memoized values not only for the initial library name, but also for its aliases. When recursively calling qt_internal_walk_libs, make sure to provide a unique out_var name based on the outer target name, and not just lib_libs. Otherwise the out_var values would be polluted from previous recursion runs. Make sure to check for -NOTFOUND in if() checks so that we reuse memoized values that are the empty string. Change-Id: I8fd8e2b0ae14d0ba8f502bc5a764d6e01095001a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtTargetHelpers.cmake')
-rw-r--r--cmake/QtTargetHelpers.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index 1d1ab7091a..fe8d461856 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -139,13 +139,18 @@ endfunction()
# Add Qt::target and Qt6::target as aliases for the target
function(qt_internal_add_target_aliases target)
+ set(versionless_alias "Qt::${target}")
+ set(versionfull_alias "Qt${PROJECT_VERSION_MAJOR}::${target}")
+ set_target_properties("${target}" PROPERTIES _qt_versionless_alias "${versionless_alias}")
+ set_target_properties("${target}" PROPERTIES _qt_versionfull_alias "${versionfull_alias}")
+
get_target_property(type "${target}" TYPE)
if (type STREQUAL EXECUTABLE)
- add_executable("Qt::${target}" ALIAS "${target}")
- add_executable("Qt${PROJECT_VERSION_MAJOR}::${target}" ALIAS "${target}")
+ add_executable("${versionless_alias}" ALIAS "${target}")
+ add_executable("${versionfull_alias}" ALIAS "${target}")
else()
- add_library("Qt::${target}" ALIAS "${target}")
- add_library("Qt${PROJECT_VERSION_MAJOR}::${target}" ALIAS "${target}")
+ add_library("${versionless_alias}" ALIAS "${target}")
+ add_library("${versionfull_alias}" ALIAS "${target}")
endif()
endfunction()