summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-29 13:10:53 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-03-29 13:11:04 (GMT)
commit5674018cc6e7f1823a5baec7e4732cbd64f28795 (patch)
treef74ddcf407033d94a3edfe495a54ad643291bd7a /Source/cmLocalGenerator.cxx
parentce0e402934a7f93a98ee86462c472938eee9226c (diff)
parenta8b7cbb787bfc3ebb139ecabac03be332cc7d6ff (diff)
downloadCMake-5674018cc6e7f1823a5baec7e4732cbd64f28795.zip
CMake-5674018cc6e7f1823a5baec7e4732cbd64f28795.tar.gz
CMake-5674018cc6e7f1823a5baec7e4732cbd64f28795.tar.bz2
Merge topic 'implicit-includes-autogen'
a8b7cbb787 Autogen: Do not treat hard-coded -I/usr/include exclusion as implicit include Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3159
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a14fd7d..2c145e0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -934,10 +934,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// Implicit include directories
std::vector<std::string> implicitDirs;
std::set<std::string> implicitSet;
- // Checks if this is not an implicit include directory
- auto notImplicit = [&implicitSet](std::string const& dir) {
- return (implicitSet.find(dir) == implicitSet.end());
- };
+ // Include directories to be excluded as if they were implicit.
+ std::set<std::string> implicitExclude;
{
// Raw list of implicit include directories
// Start with "standard" directories that we unconditionally add below.
@@ -975,7 +973,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
[](std::string const& d) {
return cmHasLiteralSuffix(d, "/usr/include");
}) != impDirVec.end()) {
- impDirVec.emplace_back("/usr/include");
+ // Only exclude this hard coded path for backwards compatibility.
+ implicitExclude.emplace("/usr/include");
}
for (std::string const& i : impDirVec) {
@@ -985,6 +984,12 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
}
}
+ // Checks if this is not an excluded (implicit) include directory.
+ auto notExcluded = [&implicitSet, &implicitExclude](std::string const& dir) {
+ return ((implicitSet.find(dir) == implicitSet.end()) &&
+ (implicitExclude.find(dir) == implicitExclude.end()));
+ };
+
// Get the target-specific include directories.
std::vector<BT<std::string>> userDirs =
target->GetIncludeDirectories(config, lang);
@@ -1001,7 +1006,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
cmSystemTools::ComparePath(udr.Value, topBinaryDir) ||
cmSystemTools::IsSubDirectory(udr.Value, topSourceDir) ||
cmSystemTools::IsSubDirectory(udr.Value, topBinaryDir)) {
- if (notImplicit(udr.Value)) {
+ if (notExcluded(udr.Value)) {
emitBT(udr);
}
}
@@ -1010,7 +1015,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// Emit remaining non implicit user direcories.
for (BT<std::string> const& udr : userDirs) {
- if (notImplicit(udr.Value)) {
+ if (notExcluded(udr.Value)) {
emitBT(udr);
}
}
@@ -1029,7 +1034,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
if (!stripImplicitDirs) {
// Append implicit directories that were requested by the user only
for (BT<std::string> const& udr : userDirs) {
- if (!notImplicit(udr.Value)) {
+ if (implicitSet.find(udr.Value) != implicitSet.end()) {
emitBT(udr);
}
}