summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 10:19:23 +0200
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 18:16:17 +0200
commitd55319c01d5482ff31166750717252e1b49f1e69 (patch)
tree7d74c9f8f9effa2cad3511a7e4f77ff58e117d94
parentfb5affe0859ae1bc07d059fc11cee3daca4d8780 (diff)
downloadcmake-d55319c01d5482ff31166750717252e1b49f1e69.tar.gz
cmInstallProgramsCommand: Port away from cmCommand
Ref: #19499
-rw-r--r--Source/cmCommands.cxx3
-rw-r--r--Source/cmInstallProgramsCommand.cxx20
-rw-r--r--Source/cmInstallProgramsCommand.h30
3 files changed, 13 insertions, 40 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 49f7c93c93..21a007c2de 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -281,8 +281,7 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("fltk_wrap_ui", cmFLTKWrapUICommand);
state->AddBuiltinCommand("include_external_msproject",
cmIncludeExternalMSProjectCommand);
- state->AddBuiltinCommand("install_programs",
- cm::make_unique<cmInstallProgramsCommand>());
+ state->AddBuiltinCommand("install_programs", cmInstallProgramsCommand);
state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
state->AddBuiltinCommand("link_libraries",
cm::make_unique<cmLinkLibrariesCommand>());
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 31a18b5d7e..6bb4409d5a 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallProgramsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -10,30 +11,29 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
static void FinalAction(cmMakefile& makefile, std::string const& dest,
std::vector<std::string> const& args);
static std::string FindInstallSource(cmMakefile& makefile, const char* name);
-// cmExecutableCommand
-bool cmInstallProgramsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmInstallProgramsCommand(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;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Enable the install target.
- this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
+ mf.GetGlobalGenerator()->EnableInstallTarget();
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+ mf.GetGlobalGenerator()->AddInstallComponent(
+ mf.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
std::string const& dest = args[0];
std::vector<std::string> const finalArgs(args.begin() + 1, args.end());
- this->Makefile->AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
+ mf.AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
FinalAction(makefile, dest, finalArgs);
});
return true;
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index ccd621df61..c567f3bac8 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmInstallProgramsCommand
- * \brief Specifies where to install some programs
- *
- * cmInstallProgramsCommand specifies the relative path where a list of
- * programs should be installed.
- */
-class cmInstallProgramsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmInstallProgramsCommand>();
- }
-
- /**
- * 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 cmInstallProgramsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif