[CMake] ADD_CUSTOM_TARGET(target ALL) and Visual Studio

Hendrik Sattler post at hendrik-sattler.de
Thu Jan 24 15:32:10 EST 2008


Am Donnerstag 24 Januar 2008 schrieb Sahn Lam:
> I have a top level custom target that depends on a header file generated by
> a custom command.  I want this custom target to be invoked first so the
> generated header is built before any other targets needing the header are
> built.
>
> Adding the ALL keyword to ADD_CUSTOM_TARGET does what I want in make, but
> it doesn't seem to work in Visual Studio.  The build order dialog shows
> that the custom target is close to last and none of the other target
> depends on it.
>
> Is this expected? How do I get it to work without using ADD_DEPENDENCIES on
> every single target that needs the generated header?
>
> I tried it on both 2.4.8 and cvs.

You want a solution without properly specifying dependencies? That's not going 
to work reliably. OTOH, cmake's scanning for include files should 
automatically generate the header before using any file that uses it. Even if 
you do not add that to ALL.

HS


More information about the CMake mailing list