summaryrefslogtreecommitdiff
path: root/Source/cmSeparateArgumentsCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSeparateArgumentsCommand.cxx')
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx21
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 28cbdc0ad..52bde7c5c 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -3,19 +3,18 @@
#include "cmSeparateArgumentsCommand.h"
#include <algorithm>
-#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
// cmSeparateArgumentsCommand
-bool cmSeparateArgumentsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmSeparateArgumentsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("must be given at least one argument.");
+ status.SetError("must be given at least one argument.");
return false;
}
@@ -57,19 +56,17 @@ bool cmSeparateArgumentsCommand::InitialPass(
command = arg;
doing = DoingNone;
} else {
- std::ostringstream e;
- e << "given unknown argument " << arg;
- this->SetError(e.str());
+ status.SetError(cmStrCat("given unknown argument ", arg));
return false;
}
}
if (mode == ModeOld) {
// Original space-replacement version of command.
- if (const char* def = this->Makefile->GetDefinition(var)) {
+ if (const char* def = status.GetMakefile().GetDefinition(var)) {
std::string value = def;
std::replace(value.begin(), value.end(), ' ', ';');
- this->Makefile->AddDefinition(var, value.c_str());
+ status.GetMakefile().AddDefinition(var, value);
}
} else {
// Parse the command line.
@@ -97,7 +94,7 @@ bool cmSeparateArgumentsCommand::InitialPass(
value += si;
}
}
- this->Makefile->AddDefinition(var, value.c_str());
+ status.GetMakefile().AddDefinition(var, value);
}
return true;