From fe6f7de8ce01c2e60d4502bf811d163c6090246f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 12 Aug 2022 12:25:51 +0200 Subject: [PATCH] CMake: Improve tool not found error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7f04e4af80c4d23b855c8c9d5f5017f8afb112ea Reviewed-by: Morten Johan Sørvig Reviewed-by: Jörg Bornemann (cherry picked from commit e671b852e70b5ed960ab2a4286aabb458e39df40) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtToolHelpers.cmake | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index 2f49e4d8726..8f488af21ce 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -168,9 +168,22 @@ function(qt_internal_add_tool target_name) endif() if(NOT QT_WILL_BUILD_TOOLS) - message(FATAL_ERROR "The tool \"${full_name}\" was not found in the " - "${tools_package_name} package. " - "Package found: ${${tools_package_name}_FOUND}") + if(${${tools_package_name}_FOUND}) + set(pkg_found_msg "") + string(APPEND pkg_found_msg + "the ${tools_package_name} package, but the package did not contain the tool. " + "Make sure that the host module ${arg_TOOLS_TARGET} was built with all features " + "enabled (no explicitly disabled tools).") + else() + set(pkg_found_msg "") + string(APPEND pkg_found_msg + "the ${tools_package_name} package, but the package could not be found. " + "Make sure you have built and installed the host ${arg_TOOLS_TARGET} module, " + "which will ensure the creation of the ${tools_package_name} package.") + endif() + message(FATAL_ERROR + "Failed to find the host tool \"${full_name}\". It is part of " + ${pkg_found_msg}) else() message(STATUS "Tool '${full_name}' will be built from source.") endif()