CMake: Allow passing -v to ninja when building examples as EPs

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 <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2022-03-23 17:33:13 +01:00
parent 2061cea0f3
commit c926ef55de

View File

@ -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}