From 75b3f7ef55303a1e8e14e855af9b27cbfe10fe2b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 16 Aug 2022 17:17:55 +0200 Subject: [PATCH] CMake: Add COMMAND_ECHO option to _qt_internal_create_command_script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7884855b7934c1f65d8699759408f5c89632ba11 Reviewed-by: Jörg Bornemann (cherry picked from commit 459f71466267a8fb5ff05de21e9a3865796d4e06) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtPublicTestHelpers.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/QtPublicTestHelpers.cmake b/cmake/QtPublicTestHelpers.cmake index 17ab6f5c976..70fa45a898d 100644 --- a/cmake/QtPublicTestHelpers.cmake +++ b/cmake/QtPublicTestHelpers.cmake @@ -10,11 +10,13 @@ # PRE_RUN and POST_RUN arguments may contain extra cmake code that supposed to be executed before # and after COMMAND, respectively. Both arguments accept a list of cmake script language # constructions. Each item of the list will be concantinated into single string with '\n' separator. +# COMMAND_ECHO option takes a value like it does for execute_process, and passes that value to +# execute_process. function(_qt_internal_create_command_script) #This style of parsing keeps ';' in ENVIRONMENT variables cmake_parse_arguments(PARSE_ARGV 0 arg "" - "OUTPUT_FILE;WORKING_DIRECTORY" + "OUTPUT_FILE;WORKING_DIRECTORY;COMMAND_ECHO" "COMMAND;ENVIRONMENT;PRE_RUN;POST_RUN" ) @@ -77,6 +79,11 @@ is not specified") string(JOIN "\n" post_run ${arg_POST_RUN}) endif() + set(command_echo "") + if(arg_COMMAND_ECHO) + set(command_echo "COMMAND_ECHO ${arg_COMMAND_ECHO}") + endif() + file(GENERATE OUTPUT "${arg_OUTPUT_FILE}" CONTENT "#!${CMAKE_COMMAND} -P # Qt generated command wrapper @@ -85,6 +92,7 @@ ${environment_extras} ${pre_run} execute_process(COMMAND ${extra_runner} ${arg_COMMAND} WORKING_DIRECTORY \"${arg_WORKING_DIRECTORY}\" + ${command_echo} RESULT_VARIABLE result ) ${post_run}