diff options
author | Brad King <brad.king@kitware.com> | 2019-02-13 14:27:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-13 15:03:56 (GMT) |
commit | 6fc33829443ea3ef2dc8cc71c0a98b635bec6179 (patch) | |
tree | cf6d2748b5016482d13dbc48b151ed71985ad0a1 /Source | |
parent | 2ad14ef4ea57c19f6cb4ed365e99a30be81eefe7 (diff) | |
download | CMake-6fc33829443ea3ef2dc8cc71c0a98b635bec6179.zip CMake-6fc33829443ea3ef2dc8cc71c0a98b635bec6179.tar.gz CMake-6fc33829443ea3ef2dc8cc71c0a98b635bec6179.tar.bz2 |
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')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b1115ea..8090e00 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)); } |