diff --git Source/cmFindLibraryCommand.cxx Source/cmFindLibraryCommand.cxx index a6b1a2155c..45b14a030a 100644 --- Source/cmFindLibraryCommand.cxx +++ Source/cmFindLibraryCommand.cxx @@ -387,7 +387,8 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, if (name.Regex.find(testName)) { this->TestPath = path; this->TestPath += origName; - if (!cmSystemTools::FileIsDirectory(this->TestPath)) { + // Make sure the path is readable and is not a directory. + if (cmSystemTools::FileExists(this->TestPath, true)) { // This is a matching file. Check if it is better than the // best name found so far. Earlier prefixes are preferred, // followed by earlier suffixes. For OpenBSD, shared library