cmFind*Command: Store candidate paths as local variables
This commit is contained in:
parent
9fb1caa1b9
commit
fbd5d4e87f
@ -220,9 +220,6 @@ struct cmFindLibraryHelper
|
||||
};
|
||||
std::vector<Name> Names;
|
||||
|
||||
// Current full path under consideration.
|
||||
std::string TestPath;
|
||||
|
||||
void RegexFromLiteral(std::string& out, std::string const& in);
|
||||
void RegexFromList(std::string& out, cmList const& in);
|
||||
size_type GetPrefixIndex(std::string const& prefix)
|
||||
@ -423,13 +420,13 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
|
||||
// one cannot tell just from the library name whether it is a static
|
||||
// library or an import library).
|
||||
if (name.TryRaw) {
|
||||
this->TestPath = cmStrCat(path, name.Raw);
|
||||
std::string testPath = cmStrCat(path, name.Raw);
|
||||
|
||||
const bool exists = cmSystemTools::FileExists(this->TestPath, true);
|
||||
const bool exists = cmSystemTools::FileExists(testPath, true);
|
||||
if (!exists) {
|
||||
this->DebugLibraryFailed(name.Raw, path);
|
||||
} else {
|
||||
auto testPath = cmSystemTools::CollapseFullPath(this->TestPath);
|
||||
testPath = cmSystemTools::CollapseFullPath(testPath);
|
||||
if (this->Validate(testPath)) {
|
||||
this->DebugLibraryFound(name.Raw, path);
|
||||
this->BestPath = testPath;
|
||||
@ -456,10 +453,10 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
|
||||
std::string const& testName = origName;
|
||||
#endif
|
||||
if (name.Regex.find(testName)) {
|
||||
this->TestPath = cmStrCat(path, origName);
|
||||
std::string testPath = cmStrCat(path, origName);
|
||||
// Make sure the path is readable and is not a directory.
|
||||
if (cmSystemTools::FileExists(this->TestPath, true)) {
|
||||
if (!this->Validate(cmSystemTools::CollapseFullPath(this->TestPath))) {
|
||||
if (cmSystemTools::FileExists(testPath, true)) {
|
||||
if (!this->Validate(cmSystemTools::CollapseFullPath(testPath))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -480,7 +477,7 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
|
||||
(prefix == bestPrefix && suffix == bestSuffix &&
|
||||
(major > bestMajor ||
|
||||
(major == bestMajor && minor > bestMinor)))) {
|
||||
this->BestPath = this->TestPath;
|
||||
this->BestPath = testPath;
|
||||
bestPrefix = prefix;
|
||||
bestSuffix = suffix;
|
||||
bestMajor = major;
|
||||
|
@ -48,12 +48,6 @@ struct cmFindProgramHelper
|
||||
// Current names under consideration.
|
||||
std::vector<std::string> Names;
|
||||
|
||||
// Current name with extension under consideration.
|
||||
std::string TestNameExt;
|
||||
|
||||
// Current full path under consideration.
|
||||
std::string TestPath;
|
||||
|
||||
// Debug state
|
||||
cmFindBaseDebugState DebugSearches;
|
||||
cmMakefile* Makefile;
|
||||
@ -91,14 +85,14 @@ struct cmFindProgramHelper
|
||||
if (!ext.empty() && cmHasSuffix(name, ext)) {
|
||||
return false;
|
||||
}
|
||||
this->TestNameExt = cmStrCat(name, ext);
|
||||
this->TestPath = cmSystemTools::CollapseFullPath(
|
||||
this->TestNameExt, path);
|
||||
bool exists = this->FileIsValid(this->TestPath);
|
||||
exists ? this->DebugSearches.FoundAt(this->TestPath)
|
||||
: this->DebugSearches.FailedAt(this->TestPath);
|
||||
std::string testNameExt = cmStrCat(name, ext);
|
||||
std::string testPath =
|
||||
cmSystemTools::CollapseFullPath(testNameExt, path);
|
||||
bool exists = this->FileIsValid(testPath);
|
||||
exists ? this->DebugSearches.FoundAt(testPath)
|
||||
: this->DebugSearches.FailedAt(testPath);
|
||||
if (exists) {
|
||||
this->BestPath = this->TestPath;
|
||||
this->BestPath = testPath;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user