summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-25 13:34:24 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-05-25 13:34:24 (GMT)
commit916d52533ea354d8945c0cba44f65ee34d0e7cd5 (patch)
tree542f15a19985aea192718b20c44bf04782a4140a /Source
parent8cd007fee664e4c7d1e3a1e50dba5b3fe973e3cf (diff)
parentc13408279f035c8261b530e26040cf4b8f01fdab (diff)
downloadCMake-916d52533ea354d8945c0cba44f65ee34d0e7cd5.zip
CMake-916d52533ea354d8945c0cba44f65ee34d0e7cd5.tar.gz
CMake-916d52533ea354d8945c0cba44f65ee34d0e7cd5.tar.bz2
Merge topic 'standard-include-directories'
c1340827 Add a variable to specify language-wide system include directories 44199097 cmMakefile: Optimize AddSystemIncludeDirectories for empty set a896043b GHS: Compute include directories consistently with other generators
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx12
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx6
-rw-r--r--Source/cmGlobalGenerator.cxx20
-rw-r--r--Source/cmMakefile.cxx4
4 files changed, 40 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 31fff9f..8859172 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2415,6 +2415,18 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
+ // Add standard include directories for this language.
+ std::string const standardIncludesVar =
+ "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES";
+ std::string const standardIncludes =
+ this->Makefile->GetSafeDefinition(standardIncludesVar);
+ std::vector<std::string>::size_type const before = includes.size();
+ cmSystemTools::ExpandListArgument(standardIncludes, includes);
+ for (std::vector<std::string>::iterator i = includes.begin() + before;
+ i != includes.end(); ++i) {
+ cmSystemTools::ConvertToUnixSlashes(*i);
+ }
+
return includes;
}
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 5e13d4c..8565fdb 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -322,8 +322,10 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
void cmGhsMultiTargetGenerator::WriteIncludes(const std::string& config,
const std::string& language)
{
- std::vector<std::string> includes =
- this->GeneratorTarget->GetIncludeDirectories(config, language);
+ std::vector<std::string> includes;
+ this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
+ language, config);
+
for (std::vector<std::string>::const_iterator includes_i = includes.begin();
includes_i != includes.end(); ++includes_i) {
*this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\""
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ec8e77c..249a3b6 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1385,6 +1385,9 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
+ std::vector<std::string> const langs =
+ this->CMakeInstance->GetState()->GetEnabledLanguages();
+
// Construct per-target generator information.
for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
cmMakefile* mf = this->Makefiles[i];
@@ -1429,6 +1432,23 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
}
}
}
+
+ // The standard include directories for each language
+ // should be treated as system include directories.
+ std::set<std::string> standardIncludesSet;
+ for (std::vector<std::string>::const_iterator li = langs.begin();
+ li != langs.end(); ++li) {
+ std::string const standardIncludesVar =
+ "CMAKE_" + *li + "_STANDARD_INCLUDE_DIRECTORIES";
+ std::string const standardIncludesStr =
+ mf->GetSafeDefinition(standardIncludesVar);
+ std::vector<std::string> standardIncludesVec;
+ cmSystemTools::ExpandListArgument(standardIncludesStr,
+ standardIncludesVec);
+ standardIncludesSet.insert(standardIncludesVec.begin(),
+ standardIncludesVec.end());
+ }
+ mf->AddSystemIncludeDirectories(standardIncludesSet);
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7e99f2c..e684689 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1574,6 +1574,10 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
{
+ if (incs.empty()) {
+ return;
+ }
+
this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end();