[CMake] Help with custom targets

Ulrik Mikaelsson ulrik.mikaelsson at gmail.com
Sat Mar 3 19:45:28 EST 2007


Alright!

So how do I create a custom target?

Looking at the documentation, ADD_CUSTOM_TARGET seems to always
recompile, since it is not associated with any output, and
ADD_CUSTOM_COMMAND(target ...) seems to only be able to add commands
to existing targets?

Regards
/ Ulrik

On 3/3/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> Ulrik Mikaelsson wrote:
> > Yes, that seems to work, with the unfortunate side-effect of having my
> > binary application unnecessarily re-built every time I change my EDC,
> > which might not be a big problem, but a bit annoying.
> >
> > Is there no way of specifying an equivalent of:
> > all: showroom data/interface.edj
> >
> > showroom: main.c
> >    $(CC) -o showroom main.c
> >
> > data/interface.edj: data/interface.edc
> >     edje_cc data/interface.edc data/interface.edj
> >
> > That is, what I'd really want would be to define a custom target,
> > linked to a file with dependencies, and a rule to build the target if
> > the dependencies are newer than the target file. Pretty much the
> > standard use-case of make, but preferably without hooking up the
> > dependency-chain on a certain executable or library. In the end, I
> > would like to be able to run "make data/interface.edj".
>
> You can do that with a custom target, but if a .h file changes that is
> included by main.c, then main.o will be recompiled.
>
> -Bill
>
>


More information about the CMake mailing list