From f0c3cfb06712509c7aa8c8d994147dc4c0a8bcfd Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 13 Jul 2022 19:05:34 +0200 Subject: [PATCH] CMake: Display reason when a Qt*Tools package is not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmake/QtPublicDependencyHelpers.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/QtPublicDependencyHelpers.cmake b/cmake/QtPublicDependencyHelpers.cmake index ccc15bf746..b04363b1db 100644 --- a/cmake/QtPublicDependencyHelpers.cmake +++ b/cmake/QtPublicDependencyHelpers.cmake @@ -61,6 +61,10 @@ macro(_qt_internal_find_tool_dependencies target target_dep_list) ${_qt_additional_packages_prefix_paths} ) 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 "") set(CMAKE_PREFIX_PATH ${BACKUP_${target}_CMAKE_PREFIX_PATH}) set(CMAKE_FIND_ROOT_PATH ${BACKUP_${target}_CMAKE_FIND_ROOT_PATH})