[CMake] Invoking ant (clean)

Alexander Neundorf a.neundorf-work at gmx.net
Mon Feb 4 14:36:09 EST 2008


On Monday 28 January 2008, Chen Levy wrote:
> Hello, List.
>
> I am setting up a build system based on CMake, that replaces the
> current build system. However some of the sources are already build
> with Apache ant, that works perfectly fine with the existing build.xml
> files.
>
> I wish to invoke ant from the generated Makefiles. I can do that with:
>
>   ADD_CUSTOM_TARGET( ant_build ALL )
>   ADD_CUSTOM_COMMAND(
>     TARGET  ant_build
>     COMMAND ant
>     )
>
> However I don't know how to activate `ant clean` as part of `make
> clean`:
>
>   ADD_CUSTOM_COMMAND(
>     TARGET  clean
>     COMMAND ant
>     ARGS    clean
>     )
>
> doesn't seem to work.
>
> Adding
>
>   ADD_CUSTOM_COMMAND( clean )
>
> works but seem to override the default clean target, which is no good
> for me.

AFAIK you can't do this.
I suggest to add a special clean target (e.g. "very_clean") or something like 
this, and then add two commands to this target: one which cleans using ant, 
and one which cleans using the current cmake build tool (i.e. make or xcode 
etc.)

Alex


More information about the CMake mailing list