cmCustomCommand: Move custom commands

This commit is contained in:
Daniel Eiband
2019-09-20 22:47:50 +02:00
committed by Brad King
parent f151a57705
commit 91abf9f3c4
5 changed files with 23 additions and 5 deletions

View File

@@ -2582,7 +2582,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
cmCustomCommand cc(nullptr, no_outputs, no_byproducts, no_depends, cmCustomCommand cc(nullptr, no_outputs, no_byproducts, no_depends,
gti.CommandLines, nullptr, gti.WorkingDir.c_str()); gti.CommandLines, nullptr, gti.WorkingDir.c_str());
cc.SetUsesTerminal(gti.UsesTerminal); cc.SetUsesTerminal(gti.UsesTerminal);
target.AddPostBuildCommand(cc); target.AddPostBuildCommand(std::move(cc));
if (!gti.Message.empty()) { if (!gti.Message.empty()) {
target.SetProperty("EchoString", gti.Message.c_str()); target.SetProperty("EchoString", gti.Message.c_str());
} }

View File

@@ -938,13 +938,13 @@ void cmMakefile::CommitCustomCommandToTarget(
cc.SetJobPool(job_pool); cc.SetJobPool(job_pool);
switch (type) { switch (type) {
case cmCustomCommandType::PRE_BUILD: case cmCustomCommandType::PRE_BUILD:
target->AddPreBuildCommand(cc); target->AddPreBuildCommand(std::move(cc));
break; break;
case cmCustomCommandType::PRE_LINK: case cmCustomCommandType::PRE_LINK:
target->AddPreLinkCommand(cc); target->AddPreLinkCommand(std::move(cc));
break; break;
case cmCustomCommandType::POST_BUILD: case cmCustomCommandType::POST_BUILD:
target->AddPostBuildCommand(cc); target->AddPostBuildCommand(std::move(cc));
break; break;
} }
this->UpdateOutputToSourceMap(byproducts, target); this->UpdateOutputToSourceMap(byproducts, target);

View File

@@ -1086,7 +1086,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
this->Dir.Work.c_str()); this->Dir.Work.c_str());
cc.SetEscapeOldStyle(false); cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true); cc.SetEscapeAllowMakeVars(true);
this->GenTarget->Target->AddPreBuildCommand(cc); this->GenTarget->Target->AddPreBuildCommand(std::move(cc));
} else { } else {
// Add link library target dependencies to the autogen target // Add link library target dependencies to the autogen target

View File

@@ -604,6 +604,11 @@ void cmTarget::AddPreBuildCommand(cmCustomCommand const& cmd)
impl->PreBuildCommands.push_back(cmd); impl->PreBuildCommands.push_back(cmd);
} }
void cmTarget::AddPreBuildCommand(cmCustomCommand&& cmd)
{
impl->PreBuildCommands.push_back(std::move(cmd));
}
std::vector<cmCustomCommand> const& cmTarget::GetPreLinkCommands() const std::vector<cmCustomCommand> const& cmTarget::GetPreLinkCommands() const
{ {
return impl->PreLinkCommands; return impl->PreLinkCommands;
@@ -614,6 +619,11 @@ void cmTarget::AddPreLinkCommand(cmCustomCommand const& cmd)
impl->PreLinkCommands.push_back(cmd); impl->PreLinkCommands.push_back(cmd);
} }
void cmTarget::AddPreLinkCommand(cmCustomCommand&& cmd)
{
impl->PreLinkCommands.push_back(std::move(cmd));
}
std::vector<cmCustomCommand> const& cmTarget::GetPostBuildCommands() const std::vector<cmCustomCommand> const& cmTarget::GetPostBuildCommands() const
{ {
return impl->PostBuildCommands; return impl->PostBuildCommands;
@@ -624,6 +634,11 @@ void cmTarget::AddPostBuildCommand(cmCustomCommand const& cmd)
impl->PostBuildCommands.push_back(cmd); impl->PostBuildCommands.push_back(cmd);
} }
void cmTarget::AddPostBuildCommand(cmCustomCommand&& cmd)
{
impl->PostBuildCommands.push_back(std::move(cmd));
}
void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
{ {
if (!srcs.empty()) { if (!srcs.empty()) {

View File

@@ -84,14 +84,17 @@ public:
//! Get the list of the PRE_BUILD custom commands for this target //! Get the list of the PRE_BUILD custom commands for this target
std::vector<cmCustomCommand> const& GetPreBuildCommands() const; std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
void AddPreBuildCommand(cmCustomCommand const& cmd); void AddPreBuildCommand(cmCustomCommand const& cmd);
void AddPreBuildCommand(cmCustomCommand&& cmd);
//! Get the list of the PRE_LINK custom commands for this target //! Get the list of the PRE_LINK custom commands for this target
std::vector<cmCustomCommand> const& GetPreLinkCommands() const; std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
void AddPreLinkCommand(cmCustomCommand const& cmd); void AddPreLinkCommand(cmCustomCommand const& cmd);
void AddPreLinkCommand(cmCustomCommand&& cmd);
//! Get the list of the POST_BUILD custom commands for this target //! Get the list of the POST_BUILD custom commands for this target
std::vector<cmCustomCommand> const& GetPostBuildCommands() const; std::vector<cmCustomCommand> const& GetPostBuildCommands() const;
void AddPostBuildCommand(cmCustomCommand const& cmd); void AddPostBuildCommand(cmCustomCommand const& cmd);
void AddPostBuildCommand(cmCustomCommand&& cmd);
//! Add sources to the target. //! Add sources to the target.
void AddSources(std::vector<std::string> const& srcs); void AddSources(std::vector<std::string> const& srcs);