From 2efd0fbc327b82bceada89753c07b7374ee0a05f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 26 Jun 2020 15:06:00 +0200 Subject: [PATCH] CMake: Add meta-target host_tools to easily build just the tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A developer could write 'ninja host_tools' to build the qtbase tools and their dependencies, and then configure another cross-compiling build dir pointing to the previous host build. This shortens the workflow for cross-building when working in qtbase. Change-Id: I69e70d23ce9df8669bcadf326d0586f097e5cb21 Reviewed-by: Tor Arne Vestbø Reviewed-by: Joerg Bornemann --- cmake/QtBuild.cmake | 7 +++++++ cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 0a4cfed66d3..ced8d4a6f01 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -4587,6 +4587,13 @@ function(qt_add_tool target_name) ) endif() + if(TARGET host_tools) + add_dependencies(host_tools "${target_name}") + if(bootstrap OR no_qt) + add_dependencies(bootstrap_tools "${target_name}") + endif() + endif() + # If building with a multi-config configuration, the main configuration tool will be placed in # ./bin, while the rest will be in specific subdirectories. qt_get_tool_cmake_configuration(tool_cmake_configuration) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index 4e2704ec92e..cf2fc8686e4 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -148,6 +148,13 @@ macro(qt_build_repo_begin) add_dependencies(install_html_docs_docs ${qt_docs_install_html_target_name}) add_dependencies(install_qch_docs_docs ${qt_docs_install_qch_target_name}) add_dependencies(install_docs_docs ${qt_docs_install_target_name}) + + # Add host_tools meta target, so that developrs can easily build only tools and their + # dependencies when working in qtbase. + if(NOT TARGET host_tools) + add_custom_target(host_tools) + add_custom_target(bootstrap_tools) + endif() endmacro() macro(qt_build_repo_end)