[CMake] How to make a target depends from target 'all'

Mehdi Rabah mehdi.rabah at gmail.com
Thu Apr 3 17:13:00 EDT 2008


On Thu, Apr 3, 2008 at 10:21 PM, Alexander Neundorf <a.neundorf-work at gmx.net>
wrote:

> On Thursday 03 April 2008, Mehdi Rabah wrote:
> ...
> > ok then I re-explain : I have a custom rule "sync" that send binaries to
> a
> > embedded computer. To make sure that the binaries that I send are the
> > lastest version (ie the source have recompiled since my last
> modification)
> > I wanted to make my "sync" target depend on "all". ie when I type "make
> > sync" the project is rebuild before the synchronisation is made. the
> same
> > result can be done by typing "make && make sync" but I want it to be
> > managed by cmake because other people in the project doesn't need to
> know
> > that they need to rebuild the project before each sync. They just have
> to
> > know "make sync".
>
> Ah, ok.
>
> You can't do this with add_dependencies() or something similar.
> Are you using exclusively "make" or also e.g. XCode or Visual Studio ?
> (ok, you're cross compiling with makefiles, so XCode and VS don't work...)
>
>
> The following should work (not tested):
>
> add_custom_target(sync
>         COMMAND ${CMAKE_BUILD_TOOLS} -C ${CMAKE_CURRENT_BINARY_DIR} all
>         COMMAND <sync your binary to the target> )
>
>
> Alex


Ok it's a good idea, I'll try this asap, it should work.

Thanks,
--
Mehdi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080403/3bfd0c52/attachment.htm>


More information about the CMake mailing list