From b96d350cff150cde6925c4e9a5e4d235ad8a7737 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 14 Sep 2020 09:36:16 +0200 Subject: [PATCH] Revert "Revert "CMake: Reduce the number of find_dependency calls"" This reverts commit 6e1a570dc8560489d10120cbd019a665f33f49c2. The build failure caused by 58c1c6ee5c986d502b56eb1cc57f1d9444d42031 has been fixed. Change-Id: I67acaa2d1dd5fc88c205b054252be2e6e26898c7 Reviewed-by: Alexandru Croitor --- cmake/QtConfigDependencies.cmake.in | 11 +++++------ cmake/QtModuleDependencies.cmake.in | 7 +++---- cmake/QtPluginDependencies.cmake.in | 7 +++---- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/cmake/QtConfigDependencies.cmake.in b/cmake/QtConfigDependencies.cmake.in index b2e59469a3..3792e9394e 100644 --- a/cmake/QtConfigDependencies.cmake.in +++ b/cmake/QtConfigDependencies.cmake.in @@ -13,6 +13,10 @@ foreach(_target_dep ${_third_party_deps}) if(version) list(APPEND find_package_args "${version}") endif() + if(components) + string(REPLACE " " ";" components "${components}") + list(APPEND find_package_args COMPONENTS ${components}) + endif() # Already build an error message, because find_dependency calls return() on failure. set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}") @@ -25,12 +29,7 @@ foreach(_target_dep ${_third_party_deps}) set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE "${__@INSTALL_CMAKE_NAMESPACE@_message}") - if(components) - string(REPLACE " " ";" components "${components}") - find_dependency(${find_package_args} COMPONENTS ${components}) - else() - find_dependency(${find_package_args}) - endif() + find_dependency(${find_package_args}) endforeach() set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE) diff --git a/cmake/QtModuleDependencies.cmake.in b/cmake/QtModuleDependencies.cmake.in index 80c5202c9a..3d19fac784 100644 --- a/cmake/QtModuleDependencies.cmake.in +++ b/cmake/QtModuleDependencies.cmake.in @@ -15,13 +15,12 @@ foreach(_target_dep ${_third_party_deps}) if(version) list(APPEND find_package_args "${version}") endif() - if(components) string(REPLACE " " ";" components "${components}") - find_dependency(${find_package_args} COMPONENTS ${components}) - else() - find_dependency(${find_package_args}) + list(APPEND find_package_args COMPONENTS ${components}) endif() + + find_dependency(${find_package_args}) endforeach() # Find Qt tool package. diff --git a/cmake/QtPluginDependencies.cmake.in b/cmake/QtPluginDependencies.cmake.in index ce64b096bb..bae6d85c7b 100644 --- a/cmake/QtPluginDependencies.cmake.in +++ b/cmake/QtPluginDependencies.cmake.in @@ -11,13 +11,12 @@ foreach(_target_dep ${_third_party_deps}) if(version) list(APPEND find_package_args "${version}") endif() - if(components) string(REPLACE " " ";" components "${components}") - find_dependency(${find_package_args} COMPONENTS ${components}) - else() - find_dependency(${find_package_args}) + list(APPEND find_package_args COMPONENTS ${components}) endif() + + find_dependency(${find_package_args}) endforeach() # note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"