diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-07-13 17:44:55 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-07-21 09:29:00 +0200 |
commit | 9a170f03a50c332f0c6332b21f0efdd710c904cb (patch) | |
tree | b63c99a73746096e9bfe01c1a7ecbc260f1c7182 /cmake | |
parent | 8de14dcfc14df5bf5e667d03004145b3d40691ee (diff) |
CMake: Remove custom Qt6 3rd party dependency implementation
Use _qt_internal_find_third_party_dependencies instead.
We rely on the inner find_dependency call to set the
Qt6_NOT_FOUND_MESSAGE message when a dependency is not found.
This implies removing the custom FATAL_ERROR handling
and relying on the parent find_package to display the
Qt6_NOT_FOUND_MESSAGE message.
We also clear Qt6_FIND_COMPONENTS if a dependency is not found.
No need to look for Qt packages if the Qt6 dependency was not met.
This reduces the amount of recursive error messages.
Task-number: QTBUG-104998
Change-Id: I5c611aaededfa63eb507ec5385b37a2fb6fcc698
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6a2358e20f03a89ce08724355b2f4863155272f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtConfig.cmake.in | 8 | ||||
-rw-r--r-- | cmake/QtConfigDependencies.cmake.in | 47 |
2 files changed, 7 insertions, 48 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in index 8ad4e45822..9f8c80a2e5 100644 --- a/cmake/QtConfig.cmake.in +++ b/cmake/QtConfig.cmake.in @@ -150,10 +150,10 @@ set(__qt_sanitizer_options_set TRUE) include(CMakeFindDependencyMacro) if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake") include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake") - if(NOT @INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND) - set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE) - message(FATAL_ERROR "Failed to find Qt Platform dependency: " - "${@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE}") + if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND) + # Clear the components, no need to look for them if dependencies were not found, otherwise + # you get a wall of recursive error messages. + set(@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS "") endif() endif() diff --git a/cmake/QtConfigDependencies.cmake.in b/cmake/QtConfigDependencies.cmake.in index b23b6681eb..52a0e1d224 100644 --- a/cmake/QtConfigDependencies.cmake.in +++ b/cmake/QtConfigDependencies.cmake.in @@ -1,51 +1,10 @@ -set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE) +set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE) # note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;" set(__qt_third_party_deps "@third_party_deps@") @third_party_extra@ -foreach(__qt_target_dep ${__qt_third_party_deps}) - list(GET __qt_target_dep 0 __qt_pkg) - list(GET __qt_target_dep 1 __qt_is_optional) - list(GET __qt_target_dep 2 __qt_version) - list(GET __qt_target_dep 3 __qt_components) - list(GET __qt_target_dep 4 __qt_optional_components) - set(__qt_find_package_args "${__qt_pkg}") - if(__qt_version) - list(APPEND __qt_find_package_args "${__qt_version}") - endif() - if(__qt_components) - string(REPLACE " " ";" __qt_components "${__qt_components}") - list(APPEND __qt_find_package_args COMPONENTS ${__qt_components}) - endif() - if(__qt_optional_components) - string(REPLACE " " ";" __qt_optional_components "${__qt_optional_components}") - list(APPEND __qt_find_package_args OPTIONAL_COMPONENTS ${__qt_optional_components}) - endif() +_qt_internal_find_third_party_dependencies(Platform __qt_third_party_deps) - # Already build an error message, because find_dependency calls return() on failure. - set(__qt_message "\nPackage: ${__qt_pkg}") - if(__qt_version) - string(APPEND __qt_message "\nVersion: ${__qt_version}") - endif() - if(__qt_components) - string(APPEND __qt_message "\nComponents: ${__qt_components}") - endif() - if(__qt_optional_components) - string(APPEND __qt_message "\nComponents: ${__qt_optional_components}") - endif() - set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE "${__qt_message}") - - if(__qt_is_optional) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND __qt_find_package_args QUIET) - endif() - find_package(${__qt_find_package_args}) - else() - find_dependency(${__qt_find_package_args}) - endif() -endforeach() - -set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE) -unset(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE) +set(@INSTALL_CMAKE_NAMESPACE@_FOUND TRUE) |