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