Commit c3fb650c authored by Brad King's avatar Brad King
Browse files

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
parent b1a37362
......@@ -345,12 +345,17 @@ void cmOrderDirectories::AddLanguageDirectories(
void cmOrderDirectories::SetImplicitDirectories(
std::set<std::string> const& implicitDirs)
this->ImplicitDirectories = implicitDirs;
for (std::set<std::string>::const_iterator i = implicitDirs.begin();
i != implicitDirs.end(); ++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) !=
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment