summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-24 15:39:25 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-25 13:30:31 (GMT)
commitc13408279f035c8261b530e26040cf4b8f01fdab (patch)
tree0532f1a061fe568a53ef5c024c8fca84451bfd8d /Source
parent4419909756751170d6fd4248b205c96767220dee (diff)
downloadCMake-c13408279f035c8261b530e26040cf4b8f01fdab.zip
CMake-c13408279f035c8261b530e26040cf4b8f01fdab.tar.gz
CMake-c13408279f035c8261b530e26040cf4b8f01fdab.tar.bz2
Add a variable to specify language-wide system include directories
Create a `CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` variable to specify system include directories for for `<LANG>` compiler command lines. This plays a role for include directories as the existing `CMAKE_<LANG>_STANDARD_LIBRARIES` variable does for link libraries.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx12
-rw-r--r--Source/cmGlobalGenerator.cxx20
2 files changed, 32 insertions, 0 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/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3f4c22f..ea2842f 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);
}
}