From f881e06dd44c377772dd3b99793ab7552c7cd64e Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 6 Jan 2025 17:10:54 +0100 Subject: [PATCH] Split the tool dendencies lookup to Qt and 3rd party Tool dependencies that are added using the qt_record_extra_package_dependency function now are considered as the third party dependencies. This allows using two different approaches when looking for the dependencies of Qt tools. All dependencies that are Qt tools now go to the path invented in 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c and use the _qt_internal_find_tool_dependencies function which is designed to look for Qt packages and uses CONFIG signature of find_package. To look for the non-Qt modules we should use more generic find_package signature and _qt_internal_find_third_party_dependencies fits perfecly for these purpose. Note that it's known issue that the _qt_internal_find_third_party_dependencies command also may find "target" tools when crosscompiling, but this commmit doesn't reinvent it. We already have various places which make the scoped "host" dependencies lookups to ensure that "host" tools look for the "host" dependencies in build systems like yocto. Ammends 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c Task-number: QTBUG-132340 Fixes: QTBUG-132622 Fixes: QTBUG-132616 Pick-to: 6.5 6.8 6.9 Change-Id: I9effba3d405ceec720a8a2a332250619cd56f598 Reviewed-by: Alexandru Croitor --- cmake/QtModuleToolsDependencies.cmake.in | 3 +++ cmake/QtToolHelpers.cmake | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cmake/QtModuleToolsDependencies.cmake.in b/cmake/QtModuleToolsDependencies.cmake.in index 8e25a8039c1..14af9c90e38 100644 --- a/cmake/QtModuleToolsDependencies.cmake.in +++ b/cmake/QtModuleToolsDependencies.cmake.in @@ -4,5 +4,8 @@ # Find "ModuleTools" dependencies, which are other ModuleTools packages. set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE) +set(__qt_@target@_tool_third_party_deps "@third_party_deps@") +_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_tool_third_party_deps) + set(__qt_@target@_tool_deps "@package_deps@") _qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps) diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index 3b53b94d1f9..641b44f73a3 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -385,6 +385,7 @@ function(qt_export_tools module_name) # List of package dependencies that need be find_package'd when using the Tools package. set(package_deps "") + set(third_party_deps "") # Additional cmake files to install set(extra_cmake_files "") @@ -397,7 +398,15 @@ function(qt_export_tools module_name) # e.g. qtwaylandscanner depends on WaylandScanner (non-qt package). get_target_property(extra_packages "${tool_name}" QT_EXTRA_PACKAGE_DEPENDENCIES) if(extra_packages) - list(APPEND package_deps "${extra_packages}") + foreach(third_party_dep IN LISTS extra_packages) + list(GET third_party_dep 0 third_party_dep_name) + list(GET third_party_dep 1 third_party_dep_version) + + # Assume that all tool thirdparty deps are mandatory. + # TODO: Components are not supported + list(APPEND third_party_deps + "${third_party_dep_name}\\\;FALSE\\\;${third_party_dep_version}\\\;\\\;") + endforeach() endif() get_target_property(_extra_cmake_files "${tool_name}" EXTRA_CMAKE_FILES)