[CMake] Dependency tracking with constructed source headers...
Brad King
brad.king at kitware.com
Mon Oct 11 08:15:40 EDT 2004
Dan Katz wrote:
> Thanks for the trick -- it solved my problem quite neatly.
[snip]
> I noticed, however, that this solution is sort of brittle.
[snip]
> Is there a simply way to understand why the dependency tracker doesn't
> pick up the dependency on the generated header from the "#include"
> statement in the source foo.cpp file?
>
> How is the system generating the dependencies anyway? I guess I'll
> take a look at the code for the scanner...
When the "make" process first enters a directory it runs a copy of CMake
to scan through the files and look for #include statements to add
dependencies. In your case the file bar.h does not exist in the include
path anywhere when foo.cpp is scanned because it hasn't been generated
yet. Therefore the dependency tracker does not find it the first time
and leaves out that particular dependency. It is certainly possible for
CMake to pick up the dependency because it knows that bar.h is a
generated file since it has a rule to build it, but this has not been
implemented. You can use the OBJECT_DEPENDS property to add the
dependency explicitly to all the .cpp files that include bar.h to work
around the problem.
-Brad
More information about the CMake
mailing list