summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 08:24:55 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 16:16:17 (GMT)
commit706400d417e6435a442af2626a8430016e24aa9d (patch)
tree82de4249f36b7c59c3b89181ca385a8b0d908f82
parent7f8699026211c6a3055e767125021a91da4b1393 (diff)
downloadCMake-706400d417e6435a442af2626a8430016e24aa9d.zip
CMake-706400d417e6435a442af2626a8430016e24aa9d.tar.gz
CMake-706400d417e6435a442af2626a8430016e24aa9d.tar.bz2
cmRemoveDefinitionsCommand: Port away from cmCommand
Ref: #19499
-rw-r--r--Source/cmCommands.cxx3
-rw-r--r--Source/cmRemoveDefinitionsCommand.cxx16
-rw-r--r--Source/cmRemoveDefinitionsCommand.h31
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<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>());
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<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;
}
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 <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