[CMake] Invoking ant (clean)

Chen Levy mailist at chenlevy.com
Mon Jan 28 08:11:33 EST 2008


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.

all other combinations of ADD_CUSTOM_COMMAND, ADD_CUSTOM_TARGET and
ADD_DEPENDENCIES simply don't work (or I was simply too stupid to make
it work).

As far as I can Google this problem, all the suggested solutions
assume knowledge of the files that where created, and tell CMake to
delete them, but in my case I don't know, nor I care what files where
created, and I am perfectly happy to let ant undo whatever it did.
-- 
  Levy, Chen
  chenlevy at imapmail.org

-- 
http://www.fastmail.fm - Accessible with your email software
                          or over the web



More information about the CMake mailing list