[CMake] How to get exit status of failing custom_command?

Tyler Roscoe tyler at cryptio.net
Thu Jun 25 12:14:09 EDT 2009


On Thu, Jun 25, 2009 at 12:23:33PM +0200, Marcel Loose wrote:
> I have defined a custom command with add_custom_command(), and the
> command inside may fail.
> 
> Is there a way to retrieve the error status of such a failing command,
> like with RESULT_VARIABLE in execute_process()?

Your custom_command will run at make time, not CMake time, so what do
you want to do with the return value? Who do you want to give it to?

A quick hack might be to write the return code into a file, then have
another script that reads the file and proceeds based on the value from
the file.

tyler


More information about the CMake mailing list