Skip to content

Commit

Permalink
cmFindPackageCommand: Avoid temporarily saving non-existent result
Browse files Browse the repository at this point in the history
  • Loading branch information
bradking committed Dec 12, 2024
1 parent 8d6b767 commit 592e95b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/cmFindPackageCommand.cxx
Original file line number Diff line number Diff line change
@@ -1437,7 +1437,7 @@ bool cmFindPackageCommand::HandlePackageMode(
// The file location was cached. Look for the correct file.
std::string file;
if (this->FindConfigFile(dir, file)) {
this->FileFound = file;
this->FileFound = std::move(file);
fileFound = true;
}
def = this->Makefile->GetDefinition(this->Variable);
@@ -2409,7 +2409,9 @@ bool cmFindPackageCommand::CheckDirectory(std::string const& dir)
}

// Look for the file in this directory.
if (this->FindConfigFile(d, this->FileFound)) {
std::string file;
if (this->FindConfigFile(d, file)) {
this->FileFound = std::move(file);
return true;
}
return false;

0 comments on commit 592e95b

Please sign in to comment.