summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-07-19 18:37:04 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-07-25 19:52:51 +0200
commit63db26a47ec49699026a4b8f0e128ecdad2570e4 (patch)
tree98150de3697fae297c98f24ae2a3a631d34c9c8e /cmake
parent3892e86d6e22e0693f4b8225058627a09d410aac (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. Pick-to: 6.4 Task-number: QTBUG-104998 Change-Id: I61db7fbb99818b4b70a0bfe3e167b6f14732292e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtConfig.cmake.in24
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}")