Skip to content

Commit db5a865

Browse files
committed
Add possibility to run post command with separate arguments
1 parent 7552ce3 commit db5a865

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cmake/modules/RootTestDriver.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ if(PRE)
5151
endif()
5252

5353
if(POST)
54-
string(REPLACE "^" ";" _post ${POST})
54+
set(POST_LIST ${POST})
55+
separate_arguments(${POST_LIST})
56+
string(REPLACE " " ";" _postargs ${POST_LIST})
57+
list(GET _postargs 0 _postcmd)
58+
list(REMOVE_AT _postargs 0)
5559
if(DBG)
56-
message(STATUS "testdriver:POST=${_post}")
60+
message(STATUS "testdriver:POST=${_postcmd}${_postargs}")
5761
endif()
5862
endif()
5963

@@ -143,7 +147,7 @@ if(CMD)
143147
set(_chkerr ERROR_VARIABLE _errvar2) # Only check out eventually
144148
endif()
145149
endif()
146-
150+
147151
execute_process(COMMAND ${_cmd} ${_input} ${_chkout} ${_chkerr} WORKING_DIRECTORY ${CWD} RESULT_VARIABLE _rc)
148152

149153
string(REGEX REPLACE "([.]*)[;][-][e][;]([^;]+)([.]*)" "\\1;-e '\\2\\3'" res "${_cmd}")
@@ -243,7 +247,7 @@ endif()
243247

244248
#---Execute post-command-----------------------------------------------------------------------------
245249
if(POST)
246-
execute_process(COMMAND ${_post} ${_cwd} OUTPUT_VARIABLE _outvar ERROR_VARIABLE _outvar RESULT_VARIABLE _rc)
250+
execute_process(COMMAND ${_postcmd} ${_postargs} ${_cwd} OUTPUT_VARIABLE _outvar ERROR_VARIABLE _outvar RESULT_VARIABLE _rc)
247251
if(_outvar)
248252
message("-- BEGIN POST OUTPUT --")
249253
message("${_outvar}")

0 commit comments

Comments
 (0)