CMake: Improve tool not found error message

Change-Id: I7f04e4af80c4d23b855c8c9d5f5017f8afb112ea
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e671b852e70b5ed960ab2a4286aabb458e39df40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2022-08-12 12:25:51 +02:00 committed by Qt Cherry-pick Bot
parent a04981505e
commit fe6f7de8ce

View File

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