summaryrefslogtreecommitdiffstats
path: root/cmake/QtConfig.cmake.in
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-07-13 18:11:54 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-07-21 09:29:03 +0200
commit3ff7cbaca3840f7a4cd269d4b93a171ac81c50ed (patch)
tree0128a96d19504ad6f3ce95f0889bfda0a6b13e70 /cmake/QtConfig.cmake.in
parent9a170f03a50c332f0c6332b21f0efdd710c904cb (diff)
CMake: Don't search for next Qt component if a required one is missing
If a project calls find_package(Qt6 COMPONENTS Gui Network) and Gui is not found, there's no reason to look for Network, because the COMPONENTS option implies that it is a required component. Failing to find a component sets Qt6_FOUND to false, so we can break early. If a project calls find_package(Qt6 OPTIONAL_COMPONENTS Gui Network) then Network will still be looked for if Gui is not found. Task-number: QTBUG-104998 Change-Id: I5c5edd27729635e6b7ade059656b49320364ad13 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit ecfc0df9b2011a458ae4622b53b4fa6aec37b2a9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/QtConfig.cmake.in')
-rw-r--r--cmake/QtConfig.cmake.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in
index 9f8c80a2e5..2f0b8e0c0c 100644
--- a/cmake/QtConfig.cmake.in
+++ b/cmake/QtConfig.cmake.in
@@ -236,6 +236,7 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
if(@INSTALL_CMAKE_NAMESPACE@_FIND_REQUIRED_${module})
set(_Qt_NOTFOUND_MESSAGE
"${_Qt_NOTFOUND_MESSAGE}Failed to find Qt component \"${module}\". ${_qt_component_not_found_msg}")
+ break()
elseif(NOT @INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY)
message(WARNING
"Failed to find Qt component \"${module}\". ${_qt_component_not_found_msg}")