diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2021-11-08 00:25:33 +0900 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-11-18 12:02:38 -0500 |
commit | 3bb2542535fa2ca1e78195b69c53916a55d322e1 (patch) | |
tree | 807f1bb4f08bdca8360c4f76b0150cefb0490177 /Source/cmAddCustomCommandCommand.cxx | |
parent | c46b041a3bcede9447c36de2f3359eb4c17f3f50 (diff) | |
download | cmake-3bb2542535fa2ca1e78195b69c53916a55d322e1.tar.gz |
cmMakefile: Simplify Add*Command and adopt to cmAddCustom*Command
Diffstat (limited to 'Source/cmAddCustomCommandCommand.cxx')
-rw-r--r-- | Source/cmAddCustomCommandCommand.cxx | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index ff2cc3eba9..0798ed466a 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -4,6 +4,9 @@ #include <sstream> #include <unordered_set> +#include <utility> + +#include <cm/memory> #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" @@ -316,20 +319,25 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args, } // Choose which mode of the command to use. - bool escapeOldStyle = !verbatim; + auto cc = cm::make_unique<cmCustomCommand>(); + cc->SetByproducts(byproducts); + cc->SetCommandLines(commandLines); + cc->SetComment(comment); + cc->SetWorkingDirectory(working.c_str()); + cc->SetEscapeOldStyle(!verbatim); + cc->SetUsesTerminal(uses_terminal); + cc->SetDepfile(depfile); + cc->SetJobPool(job_pool); + cc->SetCommandExpandLists(command_expand_lists); if (source.empty() && output.empty()) { // Source is empty, use the target. - std::vector<std::string> no_depends; - mf.AddCustomCommandToTarget(target, byproducts, no_depends, commandLines, - cctype, comment, working.c_str(), - escapeOldStyle, uses_terminal, depfile, - job_pool, command_expand_lists); + mf.AddCustomCommandToTarget(target, cctype, std::move(cc)); } else if (target.empty()) { // Target is empty, use the output. - mf.AddCustomCommandToOutput( - output, byproducts, depends, main_dependency, implicit_depends, - commandLines, comment, working.c_str(), nullptr, false, escapeOldStyle, - uses_terminal, command_expand_lists, depfile, job_pool); + cc->SetOutputs(output); + cc->SetDepends(depends); + cc->SetImplicitDepends(implicit_depends); + mf.AddCustomCommandToOutput(main_dependency, std::move(cc)); } else if (!byproducts.empty()) { status.SetError("BYPRODUCTS may not be specified with SOURCE signatures"); return false; |