how do I grab the return value of command invoked by add_custom_command
?
I thought I could do something like this,
macro(mac param1)
execute_process(COMMAND process ${param1} RESULT_VARIABLE res_var)
if(${res_var} ....
endmacro(mac)
add_custom_command(COMMAND mac(param1))
but that won't work. I found out that even a plain
macro(mac)
endmacro()
add_custom_command(COMMAND mac())
does not work. Upon building, sh complains:
/bin/sh: 1: Syntax error: end of file unexpected
or, if I do not use the macro but call execute_process
in add_custom_command
itself:
/bin/sh: 1: Syntax error: word unexpected (expecting ")")
I guess that add_custom_command
does not expect macros or built-in functions to be passed. However, how can I get the return value from the command in add_custom_command
? Or, less specifically, how can I catch that the command in add_custom_command
failed?