diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2024-02-08 13:57:04 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2024-02-14 10:47:40 +0100 |
commit | 0b79ee6d3bb569767d8be42d64783c286ac82293 (patch) | |
tree | 695092541cc9ad5f92cddcb349b32e92b834014c /cmake | |
parent | 4c58e16882797b5edaec1b7e10766f391b6fbd8a (diff) |
Make possible partial tool lookup when using QT_HOST_PATH
Consider QT_HOST_PATH when setting the QT_WILL_BUILD_TOOLS flag.
In this case if we do not crosscompile or require building tools
aka QT_FORCE_BUILD_TOOLS=ON, we may by pass tool_FOUND check and
assume that we will try building the missing tool.
Set qt_require_find_tools GLOBAL property to indicate the tools
lookup requirement.
For tools that can be found we will try re-using them from
QT_HOST_PATH, but not building from scratch.
Change-Id: I94e92f62eb799308e38721b4d580052bb4bb35f9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtToolHelpers.cmake | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index 9fa84146b8..95749451ae 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -497,25 +497,34 @@ endfunction() # Sets QT_WILL_BUILD_TOOLS if tools will be built and QT_WILL_RENAME_TOOL_TARGETS # if those tools have replaced naming. function(qt_check_if_tools_will_be_built) - # By default, we build our own tools unless we're cross-building. + # By default, we build our own tools unless we're cross-building or QT_HOST_PATH is set. set(need_target_rename FALSE) + set(require_find_tools FALSE) if(CMAKE_CROSSCOMPILING) set(will_build_tools FALSE) if(QT_FORCE_BUILD_TOOLS) set(will_build_tools TRUE) set(need_target_rename TRUE) endif() + set(require_find_tools TRUE) else() - set(will_build_tools TRUE) + if(QT_HOST_PATH) + set(will_build_tools FALSE) + else() + set(will_build_tools TRUE) + endif() if(QT_FORCE_FIND_TOOLS) set(will_build_tools FALSE) - if(QT_FORCE_BUILD_TOOLS) - set(will_build_tools TRUE) - set(need_target_rename TRUE) - endif() + set(require_find_tools TRUE) + endif() + if(QT_FORCE_BUILD_TOOLS) + set(will_build_tools TRUE) + set(need_target_rename TRUE) endif() endif() + set_property(GLOBAL PROPERTY qt_require_find_tools "${require_find_tools}") + set(QT_WILL_BUILD_TOOLS ${will_build_tools} CACHE INTERNAL "Are tools going to be built" FORCE) set(QT_WILL_RENAME_TOOL_TARGETS ${need_target_rename} CACHE INTERNAL "Do tool targets need to be renamed" FORCE) @@ -667,7 +676,8 @@ function(qt_internal_find_tool out_var target_name tools_target) endif() endif() - if(NOT QT_WILL_BUILD_TOOLS) + get_property(require_find_tools GLOBAL PROPERTY qt_require_find_tools) + if(require_find_tools AND NOT TARGET ${full_name}) if(${${tools_package_name}_FOUND}) set(pkg_found_msg "") string(APPEND pkg_found_msg @@ -684,7 +694,9 @@ function(qt_internal_find_tool out_var target_name tools_target) message(FATAL_ERROR "Failed to find the host tool \"${full_name}\". It is part of " ${pkg_found_msg}) - else() + endif() + + if(QT_WILL_BUILD_TOOLS) message(STATUS "Tool '${full_name}' will be built from source.") endif() set(${out_var} "TRUE" PARENT_SCOPE) |