summaryrefslogtreecommitdiff
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx57
1 files changed, 19 insertions, 38 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3a69b2eeed..01afc44f28 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -43,6 +43,7 @@
#include "cmGlobalGenerator.h"
#include "cmInstallGenerator.h" // IWYU pragma: keep
#include "cmInstallSubdirectoryGenerator.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMessageType.h"
@@ -1448,15 +1449,13 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
if (remove) {
if (cmValue cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
// Expand the list.
- std::vector<std::string> defs = cmExpandedList(*cdefs);
+ cmList defs{ *cdefs };
// Recompose the list without the definition.
- auto defEnd = std::remove(defs.begin(), defs.end(), define);
- auto defBegin = defs.begin();
- std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";");
+ defs.remove_items({ define });
// Store the new list.
- this->SetProperty("COMPILE_DEFINITIONS", ndefs);
+ this->SetProperty("COMPILE_DEFINITIONS", defs.to_string());
}
} else {
// Append the definition to the directory property.
@@ -1958,21 +1957,15 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
value = existingValue->c_str();
}
if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) {
- std::vector<std::string>::size_type cc;
- std::vector<std::string> files;
nvalue = value ? value : "";
- cmExpandList(nvalue, files);
- nvalue.clear();
- for (cc = 0; cc < files.size(); cc++) {
- if (!cmIsOff(files[cc])) {
- files[cc] = cmSystemTools::CollapseFullPath(files[cc]);
+ cmList files(nvalue);
+ for (auto& file : files) {
+ if (!cmIsOff(file)) {
+ file = cmSystemTools::CollapseFullPath(file);
}
- if (cc > 0) {
- nvalue += ";";
- }
- nvalue += files[cc];
}
+ nvalue = files.to_string();
this->GetCMakeInstance()->AddCacheEntry(name, nvalue, doc, type);
nvalue = *this->GetState()->GetInitializedCacheValue(name);
@@ -2064,7 +2057,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
}
if (cmValue linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
- std::vector<std::string> linkLibs = cmExpandedList(*linkLibsProp);
+ cmList linkLibs{ *linkLibsProp };
for (auto j = linkLibs.begin(); j != linkLibs.end(); ++j) {
std::string libraryName = *j;
@@ -2378,7 +2371,7 @@ void cmMakefile::ExpandVariablesCMP0019()
}
if (cmValue linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
- std::vector<std::string> linkLibs = cmExpandedList(*linkLibsProp);
+ cmList linkLibs{ *linkLibsProp };
for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) {
std::string libName = *l;
@@ -2614,18 +2607,6 @@ const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const
return this->GetDefinition(name);
}
-bool cmMakefile::GetDefExpandList(const std::string& name,
- std::vector<std::string>& out,
- bool emptyArgs) const
-{
- cmValue def = this->GetDefinition(name);
- if (!def) {
- return false;
- }
- cmExpandList(*def, out, emptyArgs);
- return true;
-}
-
std::vector<std::string> cmMakefile::GetDefinitions() const
{
std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
@@ -3266,9 +3247,9 @@ std::string cmMakefile::GetDefaultConfiguration() const
std::vector<std::string> cmMakefile::GetGeneratorConfigs(
GeneratorConfigQuery mode) const
{
- std::vector<std::string> configs;
+ cmList configs;
if (this->GetGlobalGenerator()->IsMultiConfig()) {
- this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs);
+ configs.assign(this->GetDefinition("CMAKE_CONFIGURATION_TYPES"));
} else if (mode != cmMakefile::OnlyMultiConfig) {
const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
if (!buildType.empty()) {
@@ -3278,7 +3259,7 @@ std::vector<std::string> cmMakefile::GetGeneratorConfigs(
if (mode == cmMakefile::IncludeEmptyConfig && configs.empty()) {
configs.emplace_back();
}
- return configs;
+ return std::move(configs.data());
}
bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff,
@@ -3406,7 +3387,7 @@ bool cmMakefile::ExpandArguments(
if (i.Delim == cmListFileArgument::Quoted) {
outArgs.emplace_back(value, true);
} else {
- std::vector<std::string> stringArgs = cmExpandedList(value);
+ cmList stringArgs{ value };
for (std::string const& stringArg : stringArgs) {
outArgs.emplace_back(stringArg, false);
}
@@ -3812,7 +3793,7 @@ std::string cmMakefile::GetModulesFile(const std::string& filename,
// Always search in CMAKE_MODULE_PATH:
cmValue cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
if (cmakeModulePath) {
- std::vector<std::string> modulePath = cmExpandedList(*cmakeModulePath);
+ cmList modulePath{ *cmakeModulePath };
// Look through the possible module directories.
for (std::string itempl : modulePath) {
@@ -4155,11 +4136,11 @@ void cmMakefile::GetTests(const std::string& config,
void cmMakefile::AddCMakeDependFilesFromUser()
{
- std::vector<std::string> deps;
+ cmList deps;
if (cmValue deps_str = this->GetProperty("CMAKE_CONFIGURE_DEPENDS")) {
- cmExpandList(*deps_str, deps);
+ deps.assign(*deps_str);
}
- for (std::string const& dep : deps) {
+ for (auto const& dep : deps) {
if (cmSystemTools::FileIsFullPath(dep)) {
this->AddCMakeDependFile(dep);
} else {