Auto-generated XML interfaces and dependencies
Brad King
brad.king at kitware.com
Sat Dec 29 17:13:35 CET 2007
Alexander Neundorf wrote:
> Ok, so in one directory the xml file is created using add_custom_command(),
> and used later on in targets in other directories.
>
> The official way to express the dependency to a generated file is to add the
> generated file to the sources of the target.
Correct.
> I'm not quite sure how the dependencies are handled between directories.
> Brad ?
Custom commands are only hooked into targets in the same directory in
which they are defined (not even subdirectories).
> I guess then one way would be to add a helper target
> add_custom_target(CREATE_DBUS_STUFF)
> which creates all the dbus xml interfaces, and have all the targets which need
> these interfaces depend on this helper target.
Using a target-level dependency is the correct approach. Having the
rule to generate the file in more than one target could result in
corruption during parallel builds.
> OTOH, if other targets need some part of what is built when kmail is being
> built, then it doesn't seem to be that wrong to make them depend on kmail (or
> the helper target).
Any approach that puts the generation rule in a single target on which
all other targets that use the file depend is correct. Avoiding a
helper target in favor of a target on which a dependency must be added
anyway is probably good.
-Brad
More information about the Kde-buildsystem
mailing list