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.8 6.5
Fixes: QTBUG-132340
Change-Id: I570c03037f2a92922d2546a4f5fde1bc17a7f812
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2024-12-23 20:26:01 +01:00 committed by Qt Cherry-pick Bot
parent ee533138d8
commit b942110a4a

View File

@ -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)