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

Marcel Loose loose at astron.nl
Thu Jun 25 17:39:41 EDT 2009


Aah, of course. Didn't think hard enough about this problem.

However, if the command fails during make, I would assume that make
would exit prematurely with an error status, but that didn't happen.

Am I overlooking something?

Regards,
Marcel Loose.

On Thu, 2009-06-25 at 09:14 -0700, Tyler Roscoe wrote:
> 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