cmFindPackage: Fix PACKAGE_VERSION not being set when rebuilding

This commit is contained in:
Taylor Sasser
2025-12-16 14:53:16 -05:00
parent 3182589a8b
commit 8c6676b2ea

View File

@@ -1671,6 +1671,12 @@ bool cmFindPackageCommand::HandlePackageMode(
"fileFound is true but FileFound is empty!");
fileFound = false;
}
if (fileFound) {
this->CurrentPackageInfo->Directory =
cmSystemTools::GetFilenamePath(this->FileFound);
this->CurrentPackageInfo->Version = this->VersionFound;
}
}
std::string const foundVar = cmStrCat(this->Name, "_FOUND");
@@ -1975,8 +1981,6 @@ bool cmFindPackageCommand::FindConfig()
std::string init;
if (found) {
init = cmSystemTools::GetFilenamePath(this->FileFound);
this->CurrentPackageInfo->Directory = init;
this->CurrentPackageInfo->Version = this->VersionFound;
} else {
init = this->Variable + "-NOTFOUND";
}