[CMake] Re: How to integrate 3rd-party software into cmake system

Clark J. Wang dearvoid at gmail.com
Sun Jun 10 21:08:53 EDT 2007


On 6/10/07, Mike Jackson <imikejackson at gmail.com> wrote:
>
>
>
> On Jun 10, 2007, at 8:30 AM, Clark J. Wang wrote:
>
> On 6/10/07, Jack Kelly <endgame.dos at gmail.com> wrote:
> >
> > Clark J. Wang wrote:
> > >     Clark J. Wang wrote:
> > >      > Another question:
> > >      >
> > >      > By default `make clean' does not know how to clean the
> > 3rd-party
> > >      > package. How can I add another command which will be run by
> > `make
> > >     clean'?
> > >      >
> >
> > Have you tried:
> >
> > ADD_CUSTOM_COMMAND(
> >    TARGET clean
> >    POST_BUILD
> >    COMMAND make
> >    ARGS clean
> >    WORKING_DIR dir
> >    VERBATIM
> > )
> >
> > ? I haven't, but it looks like it _should_ work.
>
>
> It does not work :-(
> Actually cmake does not view `all' or `clean' as targets. Take the
> following CMakeLists.txt as an example:
>
> ADD_CUSTOM_TARGET(
>     hello
>     COMMAND echo hello world
> )
> ADD_DEPENDENCIES(all hello)
>
> When running cmake it will report error: "ADD_DEPENDENCIES Adding
> dependency to non-existent target: all".
>
> -- Jack
> >
> >
> Without doing any checking on this I am going to say try the following:
>
> ADD_LIBRARY ( MyLibrary ${MyLibrary_Srcs})
> TARGET_LINK_LIBRARIES(MyLibrary 3rdPartyLib)
>
>
> ADD_CUSTOM_TARGET(
>     hello
>     COMMAND echo hello world
> )
> ADD_DEPENDENCIES(MyLibrary hello)
>
> I believe the idea with cmake is to link to a 'target' within the cmake
> file, not a traditional target like 'all' or 'clean'. My guess is that when
> you 'make MyLibrary' then the 'hello' target will be executed also. This
> might also hold for cleaning a target.
>

Cmake knows how to build 'hello' because we're calling
ADD_CUSTOM_TARGET(hello). But how can cmake know how to clean hello?

HTH
> --
> Mike Jackson   Senior Research Engineer
> Innovative Management & Technology Services
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070611/81e30e00/attachment.htm


More information about the CMake mailing list