diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-11 09:54:47 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-16 14:57:49 +0000 |
commit | f806c7b554405554c29294d9aa79ff18830a7dbc (patch) | |
tree | bce6861081ad4a06958ec48a4efd88ebb68d52b6 /cmake/QtTargetHelpers.cmake | |
parent | a4e53acc0c7a0a54302cd0ba42a188caf4640d9a (diff) |
CMake: Promote all targets to global within a scope when possible
CMake 3.21 introduced a new IMPORTED_TARGETS directory property which
we can use to promote all imported targets within a scope to be
global.
This would cover transitive non-Qt imported targets which the Qt build
system does not know about and is thus a more complete solution
compared to promoting only Qt targets.
Run a finalizer at the end of the directory scope where
find_package(Qt6) is called to promote all imported targets within
that scope to global (when requested).
The old promotion method is disabled when the CMake version is new
enough.
Task-number: QTBUG-92878
Task-number: QTBUG-94528
Change-Id: I533a3bd4186eba652f878ddd72c76118c2fd8bae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7f0f44f014c3ae211516fb2736401b8497dd426a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/QtTargetHelpers.cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index be1cf5e2da..00c4482c75 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -281,8 +281,8 @@ endmacro() # # The file also makes the targets global if the QT_PROMOTE_TO_GLOBAL_TARGETS property is set in the # consuming project. -# Only the specified TARGETS are made global. Transitive 3rd party targets are not made global, due -# to limitations in CMake. See https://gitlab.kitware.com/cmake/cmake/-/issues/22291 +# When using a CMake version lower than 3.21, only the specified TARGETS are made global. +# E.g. transitive non-Qt 3rd party targets of the specified targets are not made global. # # EXPORT_NAME_PREFIX: # The portion of the file name before AdditionalTargetInfo.cmake |