diff options
-rw-r--r-- | Source/cmCommands.cxx | 5 | ||||
-rw-r--r-- | Source/cmSetSourceFilesPropertiesCommand.cxx | 35 | ||||
-rw-r--r-- | Source/cmSetSourceFilesPropertiesCommand.h | 29 |
3 files changed, 25 insertions, 44 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 03aed81..b627433 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -241,9 +241,8 @@ void GetProjectCommands(cmState* state) state->AddBuiltinCommand("link_directories", cm::make_unique<cmLinkDirectoriesCommand>()); state->AddBuiltinCommand("project", cm::make_unique<cmProjectCommand>()); - state->AddBuiltinCommand( - "set_source_files_properties", - cm::make_unique<cmSetSourceFilesPropertiesCommand>()); + state->AddBuiltinCommand("set_source_files_properties", + cmSetSourceFilesPropertiesCommand); state->AddBuiltinCommand("set_target_properties", cm::make_unique<cmSetTargetPropertiesCommand>()); state->AddBuiltinCommand("set_tests_properties", diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 8e3217f..7ff604b 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -2,18 +2,23 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSetSourceFilesPropertiesCommand.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmStringAlgorithms.h" -class cmExecutionStatus; +static bool RunCommand(cmMakefile* mf, + std::vector<std::string>::const_iterator filebeg, + std::vector<std::string>::const_iterator fileend, + std::vector<std::string>::const_iterator propbeg, + std::vector<std::string>::const_iterator propend, + std::string& errors); -// cmSetSourceFilesPropertiesCommand -bool cmSetSourceFilesPropertiesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() < 2) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } @@ -29,22 +34,24 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass( ++j; } + cmMakefile& mf = status.GetMakefile(); + // now call the worker function std::string errors; - bool ret = cmSetSourceFilesPropertiesCommand::RunCommand( - this->Makefile, args.begin(), args.begin() + numFiles, - args.begin() + numFiles, args.end(), errors); + bool ret = RunCommand(&mf, args.begin(), args.begin() + numFiles, + args.begin() + numFiles, args.end(), errors); if (!ret) { - this->SetError(errors); + status.SetError(errors); } return ret; } -bool cmSetSourceFilesPropertiesCommand::RunCommand( - cmMakefile* mf, std::vector<std::string>::const_iterator filebeg, - std::vector<std::string>::const_iterator fileend, - std::vector<std::string>::const_iterator propbeg, - std::vector<std::string>::const_iterator propend, std::string& errors) +static bool RunCommand(cmMakefile* mf, + std::vector<std::string>::const_iterator filebeg, + std::vector<std::string>::const_iterator fileend, + std::vector<std::string>::const_iterator propbeg, + std::vector<std::string>::const_iterator propend, + std::string& errors) { std::vector<std::string> propertyPairs; bool generated = false; diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 6fd6c41..5eef785 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -8,34 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmMakefile; - -class cmSetSourceFilesPropertiesCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmSetSourceFilesPropertiesCommand>(); - } - - /** - * 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 RunCommand(cmMakefile* mf, - std::vector<std::string>::const_iterator filebeg, - std::vector<std::string>::const_iterator fileend, - std::vector<std::string>::const_iterator propbeg, - std::vector<std::string>::const_iterator propend, - std::string& errors); -}; +bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif |