summaryrefslogtreecommitdiff
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx36
1 files changed, 14 insertions, 22 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index b1029e62c8..98b085cdc0 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -23,6 +23,7 @@
#include "cmAlgorithms.h"
#include "cmDependencyProvider.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -1781,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) {
@@ -1811,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()
@@ -2338,7 +2330,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable()
cmValue prefix_paths =
this->Makefile->GetDefinition("CMAKE_SYSTEM_PREFIX_PATH");
// remove entry from CMAKE_SYSTEM_PREFIX_PATH
- std::vector<std::string> expanded = cmExpandedList(*prefix_paths);
+ cmList expanded{ *prefix_paths };
long count = 0;
for (const auto& path : expanded) {
bool const to_add =