我如何获取由add_custom_command?调用的命令的返回值?
我以为我可以这样做,
macro(mac param1)
execute_process(COMMAND process ${param1} RESULT_VARIABLE res_var)
if(${res_var} ....
endmacro(mac)
add_custom_command(COMMAND mac(param1))
Run Code Online (Sandbox Code Playgroud)
但那不行.我发现即使是平原
macro(mac)
endmacro()
add_custom_command(COMMAND mac())
Run Code Online (Sandbox Code Playgroud)
不起作用.在建设时,sh抱怨:
/bin/sh: 1: Syntax error: end of file unexpected
Run Code Online (Sandbox Code Playgroud)
或者,如果我不使用宏,但称execute_process在add_custom_command本身:
/bin/sh: 1: Syntax error: word unexpected (expecting ")")
Run Code Online (Sandbox Code Playgroud)
我想这add_custom_command不会指望传递宏或内置函数.但是,如何从命令中获取返回值add_custom_command?或者,不那么具体,我怎么能抓住命令add_custom_command失败?
cmake ×1