From fefaf8227cfdcabd0c25aecc91e742412c80f464 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 23 Dec 2024 20:26:01 +0100 Subject: [PATCH] Adopt the Qt dependencies lookup mechanism for tools dependencies The existing lookup mechanism doesn't consider Qt path when looking for the Qt Tool package dependencies. In good scenario this leads to the missing Qt Tool package, in worst case scenario the Tool package could be found by alternative search path and attempt using the invalid tools. Use the lookup functionality we have for Qt modules when looking for dependencies of the Qt tools. This will look the tools in Qt search paths first and only then attempt looking elsewhere, considering the QT_HOST_PATH. Pick-to: 6.5 Fixes: QTBUG-132340 Change-Id: I570c03037f2a92922d2546a4f5fde1bc17a7f812 Reviewed-by: Alexandru Croitor (cherry picked from commit 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit b942110a4a5d54ef1f225d9f71107a1c6f9132e8) --- cmake/QtModuleToolsDependencies.cmake.in | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cmake/QtModuleToolsDependencies.cmake.in b/cmake/QtModuleToolsDependencies.cmake.in index b2504a09435..8e25a8039c1 100644 --- a/cmake/QtModuleToolsDependencies.cmake.in +++ b/cmake/QtModuleToolsDependencies.cmake.in @@ -2,15 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Find "ModuleTools" dependencies, which are other ModuleTools packages. -set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE) -set(__qt_@target@_tool_deps "@package_deps@") -foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps}) - list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg) - list(GET __qt_@target@_target_dep 1 __qt_@target@_version) - - if (NOT ${__qt_@target@_pkg}_FOUND) - find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version}) - endif() -endforeach() - set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE) + +set(__qt_@target@_tool_deps "@package_deps@") +_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)