Bifcl and CMake

Hi,

it seems that Bifcl doesn't clean up its output files when it fails.
This means that if one types
   make
   # bifcl has error, make aborts but bifcl has been created
   make
   # make since that bifcl was successful because it finds the
   # bifcl output. Error messages happen were bifcl-outputfiles
   # are included in C-files.

Can you tell CMake to remove the generated output files (if they exist)
when an add_custom_command failed?

Thanks,
Gregor

PS: I'll change bifcl, so that it cleans up after itself. However, my
current error is a segfault in bifcl (which I'll try to fix as well).
But that makes me think that it would be indeed good if make can clean
up when a command fails.

it seems that Bifcl doesn't clean up its output files when it fails.
This means that if one types
   make
   # bifcl has error, make aborts but bifcl has been created
   make
   # make since that bifcl was successful because it finds the

            ^^^^^^
         should read "thinks"

Can you tell CMake to remove the generated output files (if they
exist) when an add_custom_command failed?

I'm not sure there's a special CMake way to do it, but you can try appending " || (rm -f ${bifOutputs} && exit 1)" to the ARGS parameter of the add_custom_command.

Then when `bifcl` exists with non-zero exit status, the `rm` would get invoked and then the `exit 1` would cause the CMake build to abort.

Want to try it out and put it on the fastpath if it works for you?

- Jon

Can you tell CMake to remove the generated output files (if they
exist) when an add_custom_command failed?

I'm not sure there's a special CMake way to do it, but you can try appending " || (rm -f ${bifOutputs} && exit 1)" to the ARGS parameter of the add_custom_command.

Then when `bifcl` exists with non-zero exit status, the `rm` would get invoked and then the `exit 1` would cause the CMake build to abort.

Cool thanks. That worked.

However, I'm just wondering which shell CMake / make use and whether
that syntax will always work ...

Want to try it out and put it on the fastpath if it works for you?

I don't think it's urgent (the autoconf based build seems to have the
same issue). I have it in my current branch with some other tweaks to
bifcl. I think it's fine if they all get merged together.

cu
Gregor

However, I'm just wondering which shell CMake / make use and whether
that syntax will always work ...

Good point. It's not a truly "portable" solution, but [csh, tsch, sh, bash, zsh, ksh] are all cool w/ it so far.

- Jon

cool. That's definitely fine than. As a pure bash user myself I was more
wondering about csh, tcsh, ....

thanks
gregor