CMake: Display reason when a Qt*Tools package is not found

When a package's tools dependency is not found (e.g. Core's CoreTools)
set the _NOT_FOUND_MESSAGE variable the same way that find_dependency
does.
We can't use find_dependency directly because that returns immediately
without allowing us to reset the prefix paths vars.

Pick-to: 6.4
Task-number: QTBUG-104998
Change-Id: I81e9817de8f30214fafbefe3d98ef7bc8848e715
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2022-07-13 19:05:34 +02:00
parent db07310c51
commit f0c3cfb067

View File

@ -61,6 +61,10 @@ macro(_qt_internal_find_tool_dependencies target target_dep_list)
${_qt_additional_packages_prefix_paths} ${_qt_additional_packages_prefix_paths}
) )
if (NOT ${__qt_${target}_pkg}_FOUND) if (NOT ${__qt_${target}_pkg}_FOUND)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \
${__qt_${target}_pkg} could not be found.")
if(NOT "${QT_HOST_PATH}" STREQUAL "") if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH}) set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH}) set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH})