[CMake] what happens when add_custom_command returns non zero

David Cole david.cole at kitware.com
Thu Oct 16 17:54:10 EDT 2008


That depends. Do you want it to be easy or hard to diagnose the failure...
:-) (I suppose you could concoct a case where leaving the file would make it
easier to diagnose and another case where deleting it would make it
easier...)

CMake didn't write the file, why should it delete it?
Shouldn't the tool that returned the -1 delete the partially written file on
a failure...?

One reason I can think of why CMake shouldn't be responsible for this is
that a custom command may generate *many* files, only one of which might be
reasonable to delete on a tool failure.

So..... I think CMake is correct in *not* deleting custom command output
files on custom command failure.

Discussion welcome, though.

Cheers,
David


On Thu, Oct 16, 2008 at 5:46 PM, James Bigler <jamesbigler at gmail.com> wrote:

> So what happens when add_custom_command returns non zero?
>
> Is the output file supposed to be removed?
>
> I have a command that returns -1, but happens to leave a partially
> written file.  Should CMake delete the file for me when the command
> fails?
>
> Thanks,
> James
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081016/0e1ed9d5/attachment.htm>


More information about the CMake mailing list