diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-07-14 17:00:56 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-07-21 09:29:18 +0200 |
commit | c71fcce82b52bf63008e1225824da4bd2df4b675 (patch) | |
tree | 6f6e5215d8c6897662be6202e65b317f1e0a6fbc /cmake/QtConfig.cmake.in | |
parent | 728486465242dbc538e38ba18b1417a9820a5710 (diff) |
CMake: Introduce QT_DEBUG_FIND_PACKAGE for troubleshooting
When a Qt component or dependency is not found, we will now show a
message that the user can reconfigure the project with
-DQT_DEBUG_FIND_PACKAGE=ON.
If the option is enabled, various variables that find_package uses to
find packages (like CMAKE_PREFIX_PATH, CMAKE_FIND_ROOT_PATH) will be
recorded before each find_package / find_dependency call that is
executed in any of the Qt package files.
If any find_package call fails (a package has its _FOUND variable set
to 0), the values of all those recorded variables will be shown.
This is useful to troubleshoot issues, especially when
cross-compiling, without having to manually modify the various
Config files.
Task-number: QTBUG-104998
Change-Id: I3654960597911bd704fbe3c419bcae347ab739a9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0d91f85f6cd96d321b7509c042e02636995c966c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/QtConfig.cmake.in')
-rw-r--r-- | cmake/QtConfig.cmake.in | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in index 93d9251cb9..b8db0c8da3 100644 --- a/cmake/QtConfig.cmake.in +++ b/cmake/QtConfig.cmake.in @@ -151,7 +151,7 @@ include(CMakeFindDependencyMacro) if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake") include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake") - _qt_internal_suggest_dependency_debugging( + _qt_internal_suggest_dependency_debugging(@INSTALL_CMAKE_NAMESPACE@ __qt_@INSTALL_CMAKE_NAMESPACE@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE) if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND) @@ -191,6 +191,8 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS}) ${_qt_additional_host_packages_root_paths}) endif() + _qt_internal_save_find_package_context_for_debugging(@INSTALL_CMAKE_NAMESPACE@${module}) + find_package(@INSTALL_CMAKE_NAMESPACE@${module} ${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION} ${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET} @@ -242,7 +244,8 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS}) set(_Qt_NOTFOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}Failed to find required Qt component \"${module}\". ${_qt_component_not_found_msg}") set(_qt_full_component_name "@INSTALL_CMAKE_NAMESPACE@${module}") - _qt_internal_suggest_dependency_debugging(_qt_full_component_name _Qt_NOTFOUND_MESSAGE) + _qt_internal_suggest_dependency_debugging(${_qt_full_component_name} + _qt_full_component_name _Qt_NOTFOUND_MESSAGE) unset(_qt_full_component_name) break() elseif(NOT @INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY) |