[CMake] Are target dependencies always processed before file dependencies for custom targets?

Brad King brad.king at kitware.com
Tue Oct 31 09:26:02 EST 2006


Alan W. Irwin wrote:
> I have the following situation:
> 
> One subdirectory has a complicated target build (a library).  Another
> subdirectory has a custom command which only works if the library is built
> first.
> 
> I know of no way to directly get a custom command to depend on a target.
> 
> The current solution is to create a custom target that file-depends on
> the custom command (via the DEPENDS subcommand of add_custom_target) and
> target-depends (via add_dependencies) on the library target.
> 
> This solution appears to work, but I am concerned I might be storing up
> trouble for the future or maybe even now for the make -j case, for example.
> Can I count on target-depends for my custom target _always_ being processed
> before file-depends?

Yes, that should always work.  That is in fact the intended way to do it.

-Brad



More information about the CMake mailing list