parent
242d876d7b
commit
fb5affe085
@ -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",
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user