summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-03-28 09:00:40 (GMT)
committerBrad King <brad.king@kitware.com>2019-03-28 18:07:24 (GMT)
commita8b7cbb787bfc3ebb139ecabac03be332cc7d6ff (patch)
treeb5f699901d3e212daea8907ccbdd273cada059ca /Source/cmLocalGenerator.cxx
parent97c163f5f7bd9c056b6ca0dd03f1b239ff61764b (diff)
downloadCMake-a8b7cbb787bfc3ebb139ecabac03be332cc7d6ff.zip
CMake-a8b7cbb787bfc3ebb139ecabac03be332cc7d6ff.tar.gz
CMake-a8b7cbb787bfc3ebb139ecabac03be332cc7d6ff.tar.bz2
Autogen: Do not treat hard-coded -I/usr/include exclusion as implicit include
The `cmLocalGenerator::GetIncludeDirectoriesImplicit` method is called by `cmQtAutoGenInitializer` to get the compiler's list of implicit include directories. Since commit 557b2d6e65 (Fix regression in -I/usr/include exclusion logic, 2019-02-13, v3.14.0-rc2~6^2~2) the method hard-codes exclusion of `/usr/include` for historical reasons. However, it should not be reported as a real implicit include directory unless the compiler really has it. Refactor the logic to distinguish the hard-coded exclusion of `/usr/include` from the real list of implicit include directories. Fixes: #19100
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 7e56818..7e15234 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -937,10 +937,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.
@@ -978,7 +976,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) {
@@ -988,6 +987,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);
@@ -1004,7 +1009,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);
}
}
@@ -1013,7 +1018,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);
}
}
@@ -1032,7 +1037,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);
}
}