summaryrefslogtreecommitdiffstats
path: root/Source/cmOrderDirectories.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-01 16:55:51 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-02 13:35:48 (GMT)
commitc3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d (patch)
tree2c41d5d4602d242dfa40fe75181716e7b119aab9 /Source/cmOrderDirectories.cxx
parentb1a37362b87c24d409f4037cd59c33056468c11b (diff)
downloadCMake-c3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d.zip
CMake-c3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d.tar.gz
CMake-c3fb650c85a01f1a31f3f56f5ae630d4e6c6e98d.tar.bz2
cmOrderDirectories: Consider symlinks when checking implicit directories
When checking whether a directory is "implicit" (e.g. implicit link directory or implicit rpath directory), resolve the real path of both sides of the comparison. Otherwise we will not recognize paths like `/usr/lib32` as implicit when `/usr/lib` is implicit and `lib32` is actually a symlink to `lib`. This can lead to addition of unnecessary entries to the RPATH of a binary, for example. Fixes: #16682
Diffstat (limited to 'Source/cmOrderDirectories.cxx')
-rw-r--r--Source/cmOrderDirectories.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index d93debe..d48eb53 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -345,12 +345,17 @@ void cmOrderDirectories::AddLanguageDirectories(
void cmOrderDirectories::SetImplicitDirectories(
std::set<std::string> const& implicitDirs)
{
- this->ImplicitDirectories = implicitDirs;
+ this->ImplicitDirectories.clear();
+ for (std::set<std::string>::const_iterator i = implicitDirs.begin();
+ i != implicitDirs.end(); ++i) {
+ this->ImplicitDirectories.insert(this->GetRealPath(*i));
+ }
}
bool cmOrderDirectories::IsImplicitDirectory(std::string const& dir)
{
- return this->ImplicitDirectories.find(dir) !=
+ std::string const& real = this->GetRealPath(dir);
+ return this->ImplicitDirectories.find(real) !=
this->ImplicitDirectories.end();
}