From 91abf9f3c4a80f5a8417401d5277b3b66bc7d008 Mon Sep 17 00:00:00 2001 From: Daniel Eiband Date: Fri, 20 Sep 2019 22:47:50 +0200 Subject: cmCustomCommand: Move custom commands --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 6 +++--- Source/cmQtAutoGenInitializer.cxx | 2 +- Source/cmTarget.cxx | 15 +++++++++++++++ Source/cmTarget.h | 3 +++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2273c50..c4974f3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2582,7 +2582,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti, cmCustomCommand cc(nullptr, no_outputs, no_byproducts, no_depends, gti.CommandLines, nullptr, gti.WorkingDir.c_str()); cc.SetUsesTerminal(gti.UsesTerminal); - target.AddPostBuildCommand(cc); + target.AddPostBuildCommand(std::move(cc)); if (!gti.Message.empty()) { target.SetProperty("EchoString", gti.Message.c_str()); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e53851d..d1235b2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -938,13 +938,13 @@ void cmMakefile::CommitCustomCommandToTarget( cc.SetJobPool(job_pool); switch (type) { case cmCustomCommandType::PRE_BUILD: - target->AddPreBuildCommand(cc); + target->AddPreBuildCommand(std::move(cc)); break; case cmCustomCommandType::PRE_LINK: - target->AddPreLinkCommand(cc); + target->AddPreLinkCommand(std::move(cc)); break; case cmCustomCommandType::POST_BUILD: - target->AddPostBuildCommand(cc); + target->AddPostBuildCommand(std::move(cc)); break; } this->UpdateOutputToSourceMap(byproducts, target); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 9dbd612..d7b9fa2 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1086,7 +1086,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() this->Dir.Work.c_str()); cc.SetEscapeOldStyle(false); cc.SetEscapeAllowMakeVars(true); - this->GenTarget->Target->AddPreBuildCommand(cc); + this->GenTarget->Target->AddPreBuildCommand(std::move(cc)); } else { // Add link library target dependencies to the autogen target diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1b88db6..ae77d9e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -604,6 +604,11 @@ void cmTarget::AddPreBuildCommand(cmCustomCommand const& cmd) impl->PreBuildCommands.push_back(cmd); } +void cmTarget::AddPreBuildCommand(cmCustomCommand&& cmd) +{ + impl->PreBuildCommands.push_back(std::move(cmd)); +} + std::vector const& cmTarget::GetPreLinkCommands() const { return impl->PreLinkCommands; @@ -614,6 +619,11 @@ void cmTarget::AddPreLinkCommand(cmCustomCommand const& cmd) impl->PreLinkCommands.push_back(cmd); } +void cmTarget::AddPreLinkCommand(cmCustomCommand&& cmd) +{ + impl->PreLinkCommands.push_back(std::move(cmd)); +} + std::vector const& cmTarget::GetPostBuildCommands() const { return impl->PostBuildCommands; @@ -624,6 +634,11 @@ void cmTarget::AddPostBuildCommand(cmCustomCommand const& cmd) impl->PostBuildCommands.push_back(cmd); } +void cmTarget::AddPostBuildCommand(cmCustomCommand&& cmd) +{ + impl->PostBuildCommands.push_back(std::move(cmd)); +} + void cmTarget::AddTracedSources(std::vector const& srcs) { if (!srcs.empty()) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1b4f23a..65a1ce3 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -84,14 +84,17 @@ public: //! Get the list of the PRE_BUILD custom commands for this target std::vector const& GetPreBuildCommands() const; void AddPreBuildCommand(cmCustomCommand const& cmd); + void AddPreBuildCommand(cmCustomCommand&& cmd); //! Get the list of the PRE_LINK custom commands for this target std::vector const& GetPreLinkCommands() const; void AddPreLinkCommand(cmCustomCommand const& cmd); + void AddPreLinkCommand(cmCustomCommand&& cmd); //! Get the list of the POST_BUILD custom commands for this target std::vector const& GetPostBuildCommands() const; void AddPostBuildCommand(cmCustomCommand const& cmd); + void AddPostBuildCommand(cmCustomCommand&& cmd); //! Add sources to the target. void AddSources(std::vector const& srcs); -- cgit v0.12