From 7f0f44f014c3ae211516fb2736401b8497dd426a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 11 Jun 2021 09:54:47 +0200 Subject: 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. Pick-to: 6.2 Task-number: QTBUG-92878 Task-number: QTBUG-94528 Change-Id: I533a3bd4186eba652f878ddd72c76118c2fd8bae Reviewed-by: Alexey Edelev Reviewed-by: Joerg Bornemann --- cmake/QtConfig.cmake.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmake/QtConfig.cmake.in') diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in index 19d619e7f1..98c06a46f2 100644 --- a/cmake/QtConfig.cmake.in +++ b/cmake/QtConfig.cmake.in @@ -105,3 +105,5 @@ if (_Qt_NOTFOUND_MESSAGE) set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}") set(@INSTALL_CMAKE_NAMESPACE@_FOUND False) endif() + +__qt_internal_defer_promote_targets_in_dir_scope_to_global() -- cgit v1.2.3