summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-08-16 17:17:55 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-08-17 21:21:57 +0200
commit459f71466267a8fb5ff05de21e9a3865796d4e06 (patch)
treeb9f4f2fe1aa302c3b50847cb79e7e1a7e5dfadfe /cmake
parentedb88a3b2914bcce4a0a99b17ef14e3d4db0a220 (diff)
CMake: Add COMMAND_ECHO option to _qt_internal_create_command_script
Pick-to: 6.4 Change-Id: I7884855b7934c1f65d8699759408f5c89632ba11 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPublicTestHelpers.cmake10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmake/QtPublicTestHelpers.cmake b/cmake/QtPublicTestHelpers.cmake
index 17ab6f5c97..70fa45a898 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}