summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 14:28:59 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 16:16:17 (GMT)
commit573cd4e4b43d8d3b75f6e7c420b5f833cdd2120e (patch)
treee45ae0fdfff920a55ccaffa486a92ae795e73cb5 /Source
parent95f23ea5d5a07da503f8e2ab9c52c82086cdcae4 (diff)
downloadCMake-573cd4e4b43d8d3b75f6e7c420b5f833cdd2120e.zip
CMake-573cd4e4b43d8d3b75f6e7c420b5f833cdd2120e.tar.gz
CMake-573cd4e4b43d8d3b75f6e7c420b5f833cdd2120e.tar.bz2
cmSetTestsPropertiesCommand: Port away from cmCommand
Ref: #19499
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx31
-rw-r--r--Source/cmSetTestsPropertiesCommand.h26
3 files changed, 20 insertions, 39 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index b627433..9fb07f2 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -246,7 +246,7 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("set_target_properties",
cm::make_unique<cmSetTargetPropertiesCommand>());
state->AddBuiltinCommand("set_tests_properties",
- cm::make_unique<cmSetTestsPropertiesCommand>());
+ cmSetTestsPropertiesCommand);
state->AddBuiltinCommand("subdirs", cm::make_unique<cmSubdirCommand>());
state->AddBuiltinCommand(
"target_compile_definitions",
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index ed909c6..de61eda 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -5,21 +5,25 @@
#include <iterator>
#include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmTest.h"
-class cmExecutionStatus;
+static bool SetOneTest(const std::string& tname,
+ std::vector<std::string>& propertyPairs, cmMakefile* mf,
+ std::string& errors);
-// cmSetTestsPropertiesCommand
-bool cmSetTestsPropertiesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// first collect up the list of files
std::vector<std::string> propertyPairs;
int numFiles = 0;
@@ -29,7 +33,7 @@ bool cmSetTestsPropertiesCommand::InitialPass(
// now loop through the rest of the arguments, new style
++j;
if (std::distance(j, args.end()) % 2 != 0) {
- this->SetError("called with incorrect number of arguments.");
+ status.SetError("called with incorrect number of arguments.");
return false;
}
cmAppend(propertyPairs, j, args.end());
@@ -38,8 +42,8 @@ bool cmSetTestsPropertiesCommand::InitialPass(
numFiles++;
}
if (propertyPairs.empty()) {
- this->SetError("called with illegal arguments, maybe "
- "missing a PROPERTIES specifier?");
+ status.SetError("called with illegal arguments, maybe "
+ "missing a PROPERTIES specifier?");
return false;
}
@@ -47,10 +51,9 @@ bool cmSetTestsPropertiesCommand::InitialPass(
int i;
for (i = 0; i < numFiles; ++i) {
std::string errors;
- bool ret = cmSetTestsPropertiesCommand::SetOneTest(args[i], propertyPairs,
- this->Makefile, errors);
+ bool ret = SetOneTest(args[i], propertyPairs, &mf, errors);
if (!ret) {
- this->SetError(errors);
+ status.SetError(errors);
return ret;
}
}
@@ -58,9 +61,9 @@ bool cmSetTestsPropertiesCommand::InitialPass(
return true;
}
-bool cmSetTestsPropertiesCommand::SetOneTest(
- const std::string& tname, std::vector<std::string>& propertyPairs,
- cmMakefile* mf, std::string& errors)
+static bool SetOneTest(const std::string& tname,
+ std::vector<std::string>& propertyPairs, cmMakefile* mf,
+ std::string& errors)
{
if (cmTest* test = mf->GetTest(tname)) {
// now loop through all the props and set them
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index d73e95a..4b75464 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -8,31 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmMakefile;
-
-class cmSetTestsPropertiesCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmSetTestsPropertiesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
- static bool SetOneTest(const std::string& tname,
- std::vector<std::string>& propertyPairs,
- cmMakefile* mf, std::string& errors);
-};
+bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif