mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 15:38:52 -06:00
find_package: avoid showing files as directories when searching config files
Teach `cmFileListGeneratorBase::Consider` to skip non-directories so that all call sites get the check. Fixes: #21212
This commit is contained in:
committed by
Brad King
parent
af048185b1
commit
2ff1693066
@@ -1971,6 +1971,9 @@ cmFileListGeneratorBase* cmFileListGeneratorBase::SetNext(
|
||||
bool cmFileListGeneratorBase::Consider(std::string const& fullPath,
|
||||
cmFileList& listing)
|
||||
{
|
||||
if (!cmSystemTools::FileIsDirectory(fullPath)) {
|
||||
return false;
|
||||
}
|
||||
if (this->Next) {
|
||||
return this->Next->Search(fullPath + "/", listing);
|
||||
}
|
||||
@@ -2225,10 +2228,8 @@ private:
|
||||
|
||||
// Look for directories among the matches.
|
||||
for (std::string const& f : files) {
|
||||
if (cmSystemTools::FileIsDirectory(f)) {
|
||||
if (this->Consider(f, lister)) {
|
||||
return true;
|
||||
}
|
||||
if (this->Consider(f, lister)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user