summaryrefslogtreecommitdiff
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-02-13 09:27:24 -0500
committerBrad King <brad.king@kitware.com>2019-02-13 10:03:56 -0500
commit6fc33829443ea3ef2dc8cc71c0a98b635bec6179 (patch)
treecf6d2748b5016482d13dbc48b151ed71985ad0a1 /Source/cmLocalGenerator.cxx
parent2ad14ef4ea57c19f6cb4ed365e99a30be81eefe7 (diff)
downloadcmake-6fc33829443ea3ef2dc8cc71c0a98b635bec6179.tar.gz
Update logic for sysroot in detected implicit include directories
Since commit 5990ecb741 (Compute implicit include directories from compiler output, 2018-12-07, v3.14.0-rc1~108^2) the values of the `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` variables are computed from a real compiler invocation. In this case the paths under the sysroot should already have the sysroot prefix so we should no longer have to add the sysroot prefix. However, it is also possible for project code to add its own paths to `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` without the sysroot prefix and expect the historical addition of the sysroot prefix to be preserved. Try to account for both cases by conditionally adding the sysroot prefix on implicit include directories that do not already have it.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b1115eae4c..8090e0065d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -935,6 +935,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
} else {
rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
}
+ cmSystemTools::ConvertToUnixSlashes(rootPath);
// Raw list of implicit include directories
std::vector<std::string> impDirVec;
@@ -964,8 +965,11 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
}
for (std::string const& i : impDirVec) {
- std::string imd = rootPath + i;
+ std::string imd = i;
cmSystemTools::ConvertToUnixSlashes(imd);
+ if (!rootPath.empty() && !cmHasPrefix(imd, rootPath)) {
+ imd = rootPath + imd;
+ }
if (implicitSet.insert(imd).second) {
implicitDirs.emplace_back(std::move(imd));
}