cmRemoveDefinitionsCommand: Port away from cmCommand

Ref: #19499
This commit is contained in:
Regina Pfeifer
2019-09-12 18:16:17 +02:00
parent 7f86990262
commit 706400d417
3 changed files with 8 additions and 42 deletions
+1 -2
View File
@@ -291,8 +291,7 @@ void GetProjectCommands(cmState* state)
cm::make_unique<cmLoadCacheCommand>());
state->AddBuiltinCommand("qt_wrap_cpp", cmQTWrapCPPCommand);
state->AddBuiltinCommand("qt_wrap_ui", cmQTWrapUICommand);
state->AddBuiltinCommand("remove_definitions",
cm::make_unique<cmRemoveDefinitionsCommand>());
state->AddBuiltinCommand("remove_definitions", cmRemoveDefinitionsCommand);
state->AddBuiltinCommand("source_group",
cm::make_unique<cmSourceGroupCommand>());
+5 -11
View File
@@ -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<std::string> const& args, cmExecutionStatus&)
bool cmRemoveDefinitionsCommand(std::vector<std::string> 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;
}
+2 -29
View File
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
#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<cmCommand> Clone() override
{
return cm::make_unique<cmRemoveDefinitionsCommand>();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
bool cmRemoveDefinitionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
#endif