From c926ef55de345d224195225cb997796ea8749137 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 23 Mar 2022 17:33:13 +0100 Subject: [PATCH] CMake: Allow passing -v to ninja when building examples as EPs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default when building ExternalProjects, even if the main ninja invocation has -v passed, that won't be passed to the nested ninja calls. When building examples in the CI, we want to see the full command line invocations. Allow passing -v to the nested EP ninja calls by configuring Qt with -DQT_INTERNAL_VERBOSE_EXAMPLES=ON, which we will use in our CI. We don't want to add -v by default because if the main ninja does not have one, the nested calls will still be verbose. Pick-to: 6.2 6.3 Change-Id: Ifd4b312c6eaa7354e8870f4fb0a77fadf0f33ab7 Reviewed-by: Qt CI Bot Reviewed-by: Jörg Bornemann --- cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index e05d922b160..1a05a563b1a 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -1139,6 +1139,12 @@ function(qt_internal_add_example_external_project subdir) set(example_install_prefix "${qt_example_install_prefix}/${example_rel_path}") set(ep_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}") + + set(build_command "") + if(QT_INTERNAL_VERBOSE_EXAMPLES AND CMAKE_GENERATOR MATCHES "Ninja") + set(build_command BUILD_COMMAND "${CMAKE_COMMAND}" --build "." -- -v) + endif() + ExternalProject_Add(${arg_NAME} EXCLUDE_FROM_ALL TRUE SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}" @@ -1147,6 +1153,7 @@ function(qt_internal_add_example_external_project subdir) BINARY_DIR "${ep_binary_dir}" INSTALL_DIR "${example_install_prefix}" INSTALL_COMMAND "" + ${build_command} TEST_COMMAND "" DEPENDS ${deps} CMAKE_CACHE_ARGS ${var_defs}