From 706400d417e6435a442af2626a8430016e24aa9d Mon Sep 17 00:00:00 2001 From: Regina Pfeifer Date: Thu, 12 Sep 2019 10:24:55 +0200 Subject: cmRemoveDefinitionsCommand: Port away from cmCommand Ref: #19499 --- Source/cmCommands.cxx | 3 +-- Source/cmRemoveDefinitionsCommand.cxx | 16 +++++----------- Source/cmRemoveDefinitionsCommand.h | 31 ++----------------------------- 3 files changed, 8 insertions(+), 42 deletions(-) diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index f8a0141..03aed81 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -291,8 +291,7 @@ void GetProjectCommands(cmState* state) cm::make_unique()); state->AddBuiltinCommand("qt_wrap_cpp", cmQTWrapCPPCommand); state->AddBuiltinCommand("qt_wrap_ui", cmQTWrapUICommand); - state->AddBuiltinCommand("remove_definitions", - cm::make_unique()); + state->AddBuiltinCommand("remove_definitions", cmRemoveDefinitionsCommand); state->AddBuiltinCommand("source_group", cm::make_unique()); diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx index 8d3f688..339ff9d 100644 --- a/Source/cmRemoveDefinitionsCommand.cxx +++ b/Source/cmRemoveDefinitionsCommand.cxx @@ -2,21 +2,15 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmRemoveDefinitionsCommand.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" -class cmExecutionStatus; - -// cmRemoveDefinitionsCommand -bool cmRemoveDefinitionsCommand::InitialPass( - std::vector const& args, cmExecutionStatus&) +bool cmRemoveDefinitionsCommand(std::vector const& args, + cmExecutionStatus& status) { - // it is OK to have no arguments - if (args.empty()) { - return true; - } - + cmMakefile& mf = status.GetMakefile(); for (std::string const& i : args) { - this->Makefile->RemoveDefineFlag(i); + mf.RemoveDefineFlag(i); } return true; } diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 85d01d4..868416b 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -8,36 +8,9 @@ #include #include -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -/** \class cmRemoveDefinitionsCommand - * \brief Specify a list of compiler defines - * - * cmRemoveDefinitionsCommand specifies a list of compiler defines. - * These defines will - * be removed from the compile command. - */ -class cmRemoveDefinitionsCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - std::unique_ptr Clone() override - { - return cm::make_unique(); - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector const& args, - cmExecutionStatus& status) override; -}; +bool cmRemoveDefinitionsCommand(std::vector const& args, + cmExecutionStatus& status); #endif -- cgit v0.12