<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">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&amp; path,
     if (name.Regex.find(testName)) {
       this-&gt;TestPath = path;
       this-&gt;TestPath += origName;
-      if (!cmSystemTools::FileIsDirectory(this-&gt;TestPath)) {
+      // Make sure the path is readable and is not a directory.
+      if (cmSystemTools::FileExists(this-&gt;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
</pre></body></html>