CMake: Don't repeatedly look for the Qt6 dependency

When loading Qt packages, don't look for the Qt6 dependency if it was
already found in the given subdirectory scope.

This reduces the amount of find_dependency(Qt6) calls.

Task-number: QTBUG-104998
Change-Id: I737c4433daf30eed51a058b45cd539dff7657ca4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8dac271889277d05a411136e6a765b86f1ed65f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2022-07-18 16:53:23 +02:00
parent f9adb7eb35
commit bb550bb6c2

View File

@ -13,14 +13,17 @@ endif()
# set _NOT_FOUND_MESSAGE which will be displayed by the includer of the Dependencies file. # set _NOT_FOUND_MESSAGE which will be displayed by the includer of the Dependencies file.
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED FALSE) set(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED FALSE)
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@ if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
PATHS find_dependency(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@
"${CMAKE_CURRENT_LIST_DIR}/.." PATHS
"${_qt_cmake_dir}" "${CMAKE_CURRENT_LIST_DIR}/.."
${_qt_additional_packages_prefix_paths} "${_qt_cmake_dir}"
${QT_EXAMPLES_CMAKE_PREFIX_PATH} ${_qt_additional_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages} ${QT_EXAMPLES_CMAKE_PREFIX_PATH}
) ${__qt_use_no_default_path_for_qt_packages}
)
endif()
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;" # note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_@target@_third_party_deps "@third_party_deps@") set(__qt_@target@_third_party_deps "@third_party_deps@")