summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 08:18:01 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 16:16:17 (GMT)
commitfb5affe0859ae1bc07d059fc11cee3daca4d8780 (patch)
treea59c827bc5525ff0867fd4dea5e9668994dc30ee /Source
parent242d876d7b919fe6efb3a347dfa35a66e3ef58df (diff)
downloadCMake-fb5affe0859ae1bc07d059fc11cee3daca4d8780.zip
CMake-fb5affe0859ae1bc07d059fc11cee3daca4d8780.tar.gz
CMake-fb5affe0859ae1bc07d059fc11cee3daca4d8780.tar.bz2
cmInstallFilesCommand: Port away from cmCommand
Ref: #19499
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommands.cxx3
-rw-r--r--Source/cmInstallFilesCommand.cxx23
-rw-r--r--Source/cmInstallFilesCommand.h30
3 files changed, 15 insertions, 41 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 6f01bea..49f7c93 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -236,8 +236,7 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("include_regular_expression",
cmIncludeRegularExpressionCommand);
state->AddBuiltinCommand("install", cm::make_unique<cmInstallCommand>());
- state->AddBuiltinCommand("install_files",
- cm::make_unique<cmInstallFilesCommand>());
+ state->AddBuiltinCommand("install_files", cmInstallFilesCommand);
state->AddBuiltinCommand("install_targets",
cm::make_unique<cmInstallTargetsCommand>());
state->AddBuiltinCommand("link_directories",
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 4eb5f24..d623943 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -11,8 +12,6 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
static std::string FindInstallSource(cmMakefile& makefile, const char* name);
static void CreateInstallGenerator(cmMakefile& makefile,
std::string const& dest,
@@ -20,16 +19,18 @@ static void CreateInstallGenerator(cmMakefile& makefile,
static void FinalAction(cmMakefile& makefile, std::string const& dest,
std::vector<std::string> const& args);
-bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmInstallFilesCommand(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();
std::string const& dest = args[0];
@@ -37,18 +38,18 @@ bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> files;
for (std::string const& arg : cmMakeRange(args).advance(2)) {
// Find the source location for each file listed.
- files.push_back(FindInstallSource(*this->Makefile, arg.c_str()));
+ files.push_back(FindInstallSource(mf, arg.c_str()));
}
- CreateInstallGenerator(*this->Makefile, dest, files);
+ CreateInstallGenerator(mf, dest, files);
} else {
std::vector<std::string> finalArgs(args.begin() + 1, args.end());
- this->Makefile->AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
+ mf.AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
FinalAction(makefile, dest, finalArgs);
});
}
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+ mf.GetGlobalGenerator()->AddInstallComponent(
+ mf.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index f9b84fd..f4ebbde 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmInstallFilesCommand
- * \brief Specifies where to install some files
- *
- * cmInstallFilesCommand specifies the relative path where a list of
- * files should be installed.
- */
-class cmInstallFilesCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmInstallFilesCommand>();
- }
-
- /**
- * 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 cmInstallFilesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif