mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
find_library: Check that library files are readable
Refactoring in commit 6b85166920 (ENH: Refactor find_library search
logic, 2008-09-22, v2.8.0~1665) dropped a call to `FileExists` on the
path under the assumption that the presence of a file in a directory
listing means it exists. However, dropping that also dropped a check
that verifies the file is readable. Restore the `FileExists` call to
ensure that we only find readable libraries.
This commit is contained in:
@@ -433,7 +433,8 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
|
||||
#endif
|
||||
if (name.Regex.find(testName)) {
|
||||
this->TestPath = cmStrCat(path, origName);
|
||||
if (!cmSystemTools::FileIsDirectory(this->TestPath)) {
|
||||
// Make sure the path is readable and is not a directory.
|
||||
if (cmSystemTools::FileExists(this->TestPath, true)) {
|
||||
this->DebugLibraryFound(name.Raw, dir);
|
||||
|
||||
// This is a matching file. Check if it is better than the
|
||||
|
||||
Reference in New Issue
Block a user