mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'find_package-cps-multiple-inclusion'
b498611902 find_package: Add minimal support for CPS multiple inclusion
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10581
This commit is contained in:
@@ -1543,6 +1543,7 @@ bool cmFindPackageCommand::HandlePackageMode(
|
||||
}
|
||||
}
|
||||
|
||||
std::string const fileVar = cmStrCat(this->Name, "_CONFIG");
|
||||
std::string const foundVar = cmStrCat(this->Name, "_FOUND");
|
||||
std::string const notFoundMessageVar =
|
||||
cmStrCat(this->Name, "_NOT_FOUND_MESSAGE");
|
||||
@@ -1573,7 +1574,15 @@ bool cmFindPackageCommand::HandlePackageMode(
|
||||
if (this->CpsReader) {
|
||||
// The package has been found.
|
||||
found = true;
|
||||
result = this->ReadPackage();
|
||||
|
||||
// Don't read a CPS file if we've already read it.
|
||||
cmValue const& previousFileFound =
|
||||
this->Makefile->GetDefinition(fileVar);
|
||||
if (previousFileFound.Compare(this->FileFound) == 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = this->ReadPackage();
|
||||
}
|
||||
} else if (this->ReadListFile(this->FileFound, DoPolicyScope)) {
|
||||
// The package has been found.
|
||||
found = true;
|
||||
@@ -1756,7 +1765,6 @@ bool cmFindPackageCommand::HandlePackageMode(
|
||||
this->Makefile->AddDefinition(foundVar, found ? "1" : "0");
|
||||
|
||||
// Set a variable naming the configuration file that was found.
|
||||
std::string const fileVar = cmStrCat(this->Name, "_CONFIG");
|
||||
if (found) {
|
||||
this->Makefile->AddDefinition(fileVar, this->FileFound);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user