diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-07-01 20:55:25 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-07-02 14:40:02 (GMT) |
commit | 83498d413530570f7ab9affee5b8301c888bf91e (patch) | |
tree | 08f4c2ce8a7ec31b8061369a4113af29fe504f33 | |
parent | f1fcbe3fdedb0d04fe89423331c0f2789bfe911e (diff) | |
download | CMake-83498d413530570f7ab9affee5b8301c888bf91e.zip CMake-83498d413530570f7ab9affee5b8301c888bf91e.tar.gz CMake-83498d413530570f7ab9affee5b8301c888bf91e.tar.bz2 |
Store system include directories in the cmTarget.
Entries from the cmMakefile are processed and maintained similarly
to other include directories. The include_directories(SYSTEM)
signature affects all following targets, and all prior targets
in the same makefile.
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 18 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 22 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 33 | ||||
-rw-r--r-- | Source/cmTarget.h | 9 |
5 files changed, 66 insertions, 19 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 61ff8d5..9167b25 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -51,7 +51,23 @@ const char *cmGeneratorTarget::GetProperty(const char *prop) bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, const char *config) { - return this->Makefile->IsSystemIncludeDirectory(dir, config); + for (std::set<cmStdString>::const_iterator + it = this->Target->GetSystemIncludeDirectories().begin(); + it != this->Target->GetSystemIncludeDirectories().end(); ++it) + { + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + + std::vector<std::string> incs; + cmSystemTools::ExpandListArgument(ge.Parse(*it) + ->Evaluate(this->Makefile, + config, false), incs); + if (std::find(incs.begin(), incs.end(), dir) != incs.end()) + { + return true; + } + } + return false; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f3a66ba..ecc0942 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1675,27 +1675,13 @@ cmMakefile::AddSystemIncludeDirectories(const std::set<cmStdString> &incs) { this->SystemIncludeDirectories.insert(*li); } -} -//---------------------------------------------------------------------------- -bool cmMakefile::IsSystemIncludeDirectory(const char* dir, const char *config) -{ - for (std::set<cmStdString>::const_iterator - it = this->SystemIncludeDirectories.begin(); - it != this->SystemIncludeDirectories.end(); ++it) + for (cmTargets::iterator l = this->Targets.begin(); + l != this->Targets.end(); ++l) { - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); - - std::vector<std::string> incs; - cmSystemTools::ExpandListArgument(ge.Parse(*it) - ->Evaluate(this, config, false), incs); - if (std::find(incs.begin(), incs.end(), dir) != incs.end()) - { - return true; - } + cmTarget &t = l->second; + t.AddSystemIncludeDirectories(incs); } - return false; } void cmMakefile::AddDefinition(const char* name, const char* value) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4297155..0822240 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -875,6 +875,9 @@ public: bool IsGeneratingBuildSystem(){ return this->GeneratingBuildSystem; } void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; } + std::set<cmStdString> const & GetSystemIncludeDirectories() const + { return this->SystemIncludeDirectories; } + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const char* name, cmTarget& target); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a90fa74..7ad42f8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1647,6 +1647,17 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->InsertInclude(*it); } + + const std::set<cmStdString> parentSystemIncludes = + this->Makefile->GetSystemIncludeDirectories(); + + for (std::set<cmStdString>::const_iterator it + = parentSystemIncludes.begin(); + it != parentSystemIncludes.end(); ++it) + { + this->SystemIncludeDirectories.insert(*it); + } + const std::vector<cmValueWithOrigin> parentOptions = this->Makefile->GetCompileOptionsEntries(); @@ -2524,6 +2535,28 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, //---------------------------------------------------------------------------- void +cmTarget::AddSystemIncludeDirectories(const std::set<cmStdString> &incs) +{ + for(std::set<cmStdString>::const_iterator li = incs.begin(); + li != incs.end(); ++li) + { + this->SystemIncludeDirectories.insert(*li); + } +} + +//---------------------------------------------------------------------------- +void +cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs) +{ + for(std::vector<std::string>::const_iterator li = incs.begin(); + li != incs.end(); ++li) + { + this->SystemIncludeDirectories.insert(*li); + } +} + +//---------------------------------------------------------------------------- +void cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) { // There are two key parts of the dependency analysis: (1) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3bc0ab2..ff6d923 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -533,7 +533,16 @@ public: std::string GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt); + + void AddSystemIncludeDirectories(const std::set<cmStdString> &incs); + void AddSystemIncludeDirectories(const std::vector<std::string> &incs); + std::set<cmStdString> const & GetSystemIncludeDirectories() const + { return this->SystemIncludeDirectories; } private: + // The set of include directories that are marked as system include + // directories. + std::set<cmStdString> SystemIncludeDirectories; + /** * A list of direct dependencies. Use in conjunction with DependencyMap. */ |