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>
This commit is contained in:
parent
9a170f03a5
commit
3ff7cbaca3
@ -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}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user