1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmCustomCommand.h"
8 #include <cmext/algorithm>
10 const std::vector<std::string>& cmCustomCommand::GetOutputs() const
15 void cmCustomCommand::SetOutputs(std::vector<std::string> outputs)
17 this->Outputs = std::move(outputs);
20 void cmCustomCommand::SetOutputs(std::string output)
22 this->Outputs = { std::move(output) };
25 const std::vector<std::string>& cmCustomCommand::GetByproducts() const
27 return this->Byproducts;
30 void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts)
32 this->Byproducts = std::move(byproducts);
35 const std::vector<std::string>& cmCustomCommand::GetDepends() const
40 void cmCustomCommand::SetDepends(std::vector<std::string> depends)
42 if (this->HasMainDependency_) {
43 depends.insert(depends.begin(), std::move(this->Depends[0]));
46 Depends = std::move(depends);
49 const std::string& cmCustomCommand::GetMainDependency() const
51 assert(this->HasMainDependency_);
52 return this->Depends[0];
55 void cmCustomCommand::SetMainDependency(std::string main_dependency)
57 if (this->HasMainDependency_) {
58 assert(!main_dependency.empty());
59 this->Depends[0] = std::move(main_dependency);
60 } else if (main_dependency.empty()) {
63 this->Depends.insert(this->Depends.begin(), std::move(main_dependency));
64 this->HasMainDependency_ = true;
68 const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
70 return this->CommandLines;
73 void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
75 this->CommandLines = std::move(commandLines);
78 const char* cmCustomCommand::GetComment() const
80 const char* no_comment = nullptr;
81 return this->HaveComment ? this->Comment.c_str() : no_comment;
84 void cmCustomCommand::SetComment(const char* comment)
86 this->Comment = comment ? comment : "";
87 this->HaveComment = (comment != nullptr);
90 void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
92 cm::append(this->CommandLines, commandLines);
95 void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
97 cm::append(this->Depends, depends);
100 bool cmCustomCommand::GetEscapeOldStyle() const
102 return this->EscapeOldStyle;
105 void cmCustomCommand::SetEscapeOldStyle(bool b)
107 this->EscapeOldStyle = b;
110 bool cmCustomCommand::GetEscapeAllowMakeVars() const
112 return this->EscapeAllowMakeVars;
115 void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
117 this->EscapeAllowMakeVars = b;
120 cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
122 return this->Backtrace;
125 void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt)
127 this->Backtrace = std::move(lfbt);
130 cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
132 return this->ImplicitDepends;
135 void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l)
137 this->ImplicitDepends = l;
140 void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l)
142 cm::append(this->ImplicitDepends, l);
145 bool cmCustomCommand::GetUsesTerminal() const
147 return this->UsesTerminal;
150 void cmCustomCommand::SetUsesTerminal(bool b)
152 this->UsesTerminal = b;
155 bool cmCustomCommand::GetCommandExpandLists() const
157 return this->CommandExpandLists;
160 void cmCustomCommand::SetCommandExpandLists(bool b)
162 this->CommandExpandLists = b;
165 const std::string& cmCustomCommand::GetDepfile() const
167 return this->Depfile;
170 void cmCustomCommand::SetDepfile(const std::string& depfile)
172 this->Depfile = depfile;
175 const std::string& cmCustomCommand::GetJobPool() const
177 return this->JobPool;
180 void cmCustomCommand::SetJobPool(const std::string& job_pool)
182 this->JobPool = job_pool;
185 cmPolicies::PolicyStatus cmCustomCommand::GetCMP0116Status() const
187 return this->CMP0116Status;
190 void cmCustomCommand::SetCMP0116Status(cmPolicies::PolicyStatus cmp0116)
192 this->CMP0116Status = cmp0116;
195 const std::string& cmCustomCommand::GetTarget() const
200 void cmCustomCommand::SetTarget(const std::string& target)
202 this->Target = target;