[cmake-developers] Printing the origin of include dirs
Stephen Kelly
steveire at gmail.com
Wed Dec 19 09:49:54 EST 2012
Brad King wrote:
> Okay. Since this is purely internal it can be factored into a generalized
> approach later.
Great. I mentioned this before:
> Note that the branch is work in progress. Currently the backtrace is not
> always initialized correctly when include_directories() is used. What do
> ya'll think of the idea?
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?
Thanks,
Steve.
More information about the cmake-developers
mailing list