diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-07-19 18:37:04 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-07-27 13:49:02 +0200 |
commit | 489ade90c67af411501ad35cee9587afac1531a2 (patch) | |
tree | 7a3f853f3650b2d415cf830b1a29956ee26d99f7 /cmake | |
parent | 22a4fc0e38ba4da6fb14af965232ccf498f75668 (diff) |
CMake: Don't look for Qt6 components that are already found
This matches what we do in Dependencies.cmake files, except this time
for COMPONENTS passed to the Qt6 package.
For example if a project does
find_package(Qt6 COMPONENTS Widgets Core)
we'd end up looking for Core twice. Once as a dependency of Widgets
and once as a standalone request of the project.
Make sure to skip the second lookup if it was already found.
Task-number: QTBUG-104998
Change-Id: I61db7fbb99818b4b70a0bfe3e167b6f14732292e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 63db26a47ec49699026a4b8f0e128ecdad2570e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtConfig.cmake.in | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in index b9cf5e0964..3b38eb037d 100644 --- a/cmake/QtConfig.cmake.in +++ b/cmake/QtConfig.cmake.in @@ -183,17 +183,19 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS}) _qt_internal_save_find_package_context_for_debugging(@INSTALL_CMAKE_NAMESPACE@${module}) - find_package(@INSTALL_CMAKE_NAMESPACE@${module} - ${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION} - ${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET} - PATHS - ${_qt_cmake_dir} - ${_qt_additional_packages_prefix_paths} - ${QT_EXAMPLES_CMAKE_PREFIX_PATH} - ${__qt_find_package_host_qt_path} - ${_qt_additional_host_packages_prefix_paths} - ${__qt_use_no_default_path_for_qt_packages} - ) + if(NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND) + find_package(@INSTALL_CMAKE_NAMESPACE@${module} + ${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION} + ${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET} + PATHS + ${_qt_cmake_dir} + ${_qt_additional_packages_prefix_paths} + ${QT_EXAMPLES_CMAKE_PREFIX_PATH} + ${__qt_find_package_host_qt_path} + ${_qt_additional_host_packages_prefix_paths} + ${__qt_use_no_default_path_for_qt_packages} + ) + endif() if(NOT "${__qt_find_package_host_qt_path}" STREQUAL "") set(CMAKE_PREFIX_PATH "${__qt_backup_cmake_prefix_path}") |