[CMake] Bug in EXECUTE_PROCESS?

Jesper Eskilson jesper at eskilson.se
Tue Dec 4 08:41:23 EST 2007


Josef Karthauser wrote:
> Is this a bug?
> 
>  
> 
>  EXECUTE_PROCESS(
> 
> COMMAND badcmd_that_doesnt_exist
> 
>                                 ERROR_VARIABLE ERROR
> 
> )
> 
> IF(ERROR)
> 
> MESSAGE(FATAL_ERROR "Error! Command doesn’t exist.")
> 
> ENDIF(ERROR)
> 
>  
> 
> as the fatal_error is never raised.
> 
>  
> 
> If not, what’s the canonical way of reliably determining whether the
> process succeeded or failed?

Without actually checking the docs, I would guess that ERROR contains
the exit code of the process, i.e. non-zero on failure. Try comparing
ERROR against 0 instead.

--
/Jesper


More information about the CMake mailing list