summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-04-25 17:54:23 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-04-29 07:54:31 (GMT)
commit241304190ffdf9cc7d4ede0601da370b111468cc (patch)
treee35dd7fe5c89da1eed3abe10f37abe3586e64df7 /Source/cmFindPackageCommand.cxx
parent87fe031a0703f07b8636f8ea59b6746788e71869 (diff)
downloadCMake-241304190ffdf9cc7d4ede0601da370b111468cc.zip
CMake-241304190ffdf9cc7d4ede0601da370b111468cc.tar.gz
CMake-241304190ffdf9cc7d4ede0601da370b111468cc.tar.bz2
CMake code rely on cmList class for CMake lists management (part. 2)
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx33
1 files changed, 12 insertions, 21 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 656703c..98b085c 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1782,28 +1782,20 @@ bool cmFindPackageCommand::ReadListFile(const std::string& f,
void cmFindPackageCommand::AppendToFoundProperty(const bool found)
{
- std::vector<std::string> foundContents;
+ cmList foundContents;
cmValue foundProp =
this->Makefile->GetState()->GetGlobalProperty("PACKAGES_FOUND");
- if (cmNonempty(foundProp)) {
- cmExpandList(*foundProp, foundContents, false);
- auto nameIt =
- std::find(foundContents.begin(), foundContents.end(), this->Name);
- if (nameIt != foundContents.end()) {
- foundContents.erase(nameIt);
- }
+ if (!foundProp.IsEmpty()) {
+ foundContents.assign(*foundProp);
+ foundContents.remove_items({ this->Name });
}
- std::vector<std::string> notFoundContents;
+ cmList notFoundContents;
cmValue notFoundProp =
this->Makefile->GetState()->GetGlobalProperty("PACKAGES_NOT_FOUND");
- if (cmNonempty(notFoundProp)) {
- cmExpandList(*notFoundProp, notFoundContents, false);
- auto nameIt =
- std::find(notFoundContents.begin(), notFoundContents.end(), this->Name);
- if (nameIt != notFoundContents.end()) {
- notFoundContents.erase(nameIt);
- }
+ if (!notFoundProp.IsEmpty()) {
+ notFoundContents.assign(*notFoundProp);
+ notFoundContents.remove_items({ this->Name });
}
if (found) {
@@ -1812,12 +1804,11 @@ void cmFindPackageCommand::AppendToFoundProperty(const bool found)
notFoundContents.push_back(this->Name);
}
- std::string tmp = cmJoin(foundContents, ";");
- this->Makefile->GetState()->SetGlobalProperty("PACKAGES_FOUND", tmp.c_str());
+ this->Makefile->GetState()->SetGlobalProperty(
+ "PACKAGES_FOUND", foundContents.to_string().c_str());
- tmp = cmJoin(notFoundContents, ";");
- this->Makefile->GetState()->SetGlobalProperty("PACKAGES_NOT_FOUND",
- tmp.c_str());
+ this->Makefile->GetState()->SetGlobalProperty(
+ "PACKAGES_NOT_FOUND", notFoundContents.to_string().c_str());
}
void cmFindPackageCommand::AppendSuccessInformation()