mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 23:29:55 -05:00
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user