[cmake-developers] Printing the origin of include dirs
Brad King
brad.king at kitware.com
Wed Dec 19 13:18:03 EST 2012
On 12/19/2012 09:49 AM, Stephen Kelly wrote:
> The problem is that in this code:
>
> include_directories(foo/bar)
> add_library(the_lib ...)
>
> the INCLUDE_DIRECTORIES target property is seeded by the directory property
> of the same name. The backtrace then leads to the add_library invokation
> instead of the include_directories invokation.
>
> The fix is to modify the management of INCLUDE_DIRECTORIES in cmMakefile to
> be based on std::vector<cmMakefile::IncludeDirectoriesEntry>, where:
>
> struct IncludeDirectoriesEntry
> {
> std::string Value;
> cmListFileBacktrace Backtrace;
> };
>
> and then use *that* backtrace (and some new API on cmTarget) in
> cmTarget::SetMakefile, instead of
>
> this->SetProperty("INCLUDE_DIRECTORIES",
> this->Makefile->GetProperty("INCLUDE_DIRECTORIES"));
>
> Are you ok with that?
Yes, but this is where having some more smarts inside cmProperty
could help. If the value itself knew where it came from then this
information could be propagated when the value is copied into
another property.
-Brad
More information about the cmake-developers
mailing list