summaryrefslogtreecommitdiff
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-21 11:09:32 -0500
committerBrad King <brad.king@kitware.com>2019-01-21 11:14:07 -0500
commit15ad8300621eaf9fe23cda30368f90b420505d43 (patch)
tree8ac4188548a5addf9634e0d8f243a875b918197e /Source/cmLocalGenerator.cxx
parenta61c061b6143cb6d8920b1b5796a867c0f104556 (diff)
downloadcmake-15ad8300621eaf9fe23cda30368f90b420505d43.tar.gz
Refactor exclusion of -I/usr/include to avoid per-language values
Add a `CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES` to contain the hard-coded list of paths to be excluded from `-I` arguments so that the values remain excluded even if the per-language `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` variants change. This is needed to preserve our historical exclusion of `-I/usr/include` even when it is not a real implicit include directory. A policy may be needed to remove it later.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 797add990f..54f1c7fe9e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -947,21 +947,29 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectories(
rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
}
+ std::vector<std::string> impDirVec;
+
+ // Get platform-wide implicit directories.
+ if (const char* implicitIncludes = (this->Makefile->GetDefinition(
+ "CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"))) {
+ cmSystemTools::ExpandListArgument(implicitIncludes, impDirVec);
+ }
+
// Load implicit include directories for this language.
std::string key = "CMAKE_";
key += lang;
key += "_IMPLICIT_INCLUDE_DIRECTORIES";
if (const char* value = this->Makefile->GetDefinition(key)) {
- std::vector<std::string> impDirVec;
cmSystemTools::ExpandListArgument(value, impDirVec);
- for (std::string const& i : impDirVec) {
- {
- std::string d = rootPath + i;
- cmSystemTools::ConvertToUnixSlashes(d);
- emitted.insert(std::move(d));
- }
- implicitDirs.push_back(i);
+ }
+
+ for (std::string const& i : impDirVec) {
+ {
+ std::string d = rootPath + i;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ emitted.insert(std::move(d));
}
+ implicitDirs.push_back(i);
}
}