resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmCustomCommand.cxx
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"
4
5 #include <cassert>
6 #include <utility>
7
8 #include <cmext/algorithm>
9
10 const std::vector<std::string>& cmCustomCommand::GetOutputs() const
11 {
12   return this->Outputs;
13 }
14
15 void cmCustomCommand::SetOutputs(std::vector<std::string> outputs)
16 {
17   this->Outputs = std::move(outputs);
18 }
19
20 void cmCustomCommand::SetOutputs(std::string output)
21 {
22   this->Outputs = { std::move(output) };
23 }
24
25 const std::vector<std::string>& cmCustomCommand::GetByproducts() const
26 {
27   return this->Byproducts;
28 }
29
30 void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts)
31 {
32   this->Byproducts = std::move(byproducts);
33 }
34
35 const std::vector<std::string>& cmCustomCommand::GetDepends() const
36 {
37   return this->Depends;
38 }
39
40 void cmCustomCommand::SetDepends(std::vector<std::string> depends)
41 {
42   if (this->HasMainDependency_) {
43     depends.insert(depends.begin(), std::move(this->Depends[0]));
44   }
45
46   Depends = std::move(depends);
47 }
48
49 const std::string& cmCustomCommand::GetMainDependency() const
50 {
51   assert(this->HasMainDependency_);
52   return this->Depends[0];
53 }
54
55 void cmCustomCommand::SetMainDependency(std::string main_dependency)
56 {
57   if (this->HasMainDependency_) {
58     assert(!main_dependency.empty());
59     this->Depends[0] = std::move(main_dependency);
60   } else if (main_dependency.empty()) {
61     // Do nothing.
62   } else {
63     this->Depends.insert(this->Depends.begin(), std::move(main_dependency));
64     this->HasMainDependency_ = true;
65   }
66 }
67
68 const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
69 {
70   return this->CommandLines;
71 }
72
73 void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
74 {
75   this->CommandLines = std::move(commandLines);
76 }
77
78 const char* cmCustomCommand::GetComment() const
79 {
80   const char* no_comment = nullptr;
81   return this->HaveComment ? this->Comment.c_str() : no_comment;
82 }
83
84 void cmCustomCommand::SetComment(const char* comment)
85 {
86   this->Comment = comment ? comment : "";
87   this->HaveComment = (comment != nullptr);
88 }
89
90 void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
91 {
92   cm::append(this->CommandLines, commandLines);
93 }
94
95 void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
96 {
97   cm::append(this->Depends, depends);
98 }
99
100 bool cmCustomCommand::GetEscapeOldStyle() const
101 {
102   return this->EscapeOldStyle;
103 }
104
105 void cmCustomCommand::SetEscapeOldStyle(bool b)
106 {
107   this->EscapeOldStyle = b;
108 }
109
110 bool cmCustomCommand::GetEscapeAllowMakeVars() const
111 {
112   return this->EscapeAllowMakeVars;
113 }
114
115 void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
116 {
117   this->EscapeAllowMakeVars = b;
118 }
119
120 cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
121 {
122   return this->Backtrace;
123 }
124
125 void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt)
126 {
127   this->Backtrace = std::move(lfbt);
128 }
129
130 cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
131 {
132   return this->ImplicitDepends;
133 }
134
135 void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l)
136 {
137   this->ImplicitDepends = l;
138 }
139
140 void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l)
141 {
142   cm::append(this->ImplicitDepends, l);
143 }
144
145 bool cmCustomCommand::GetUsesTerminal() const
146 {
147   return this->UsesTerminal;
148 }
149
150 void cmCustomCommand::SetUsesTerminal(bool b)
151 {
152   this->UsesTerminal = b;
153 }
154
155 bool cmCustomCommand::GetCommandExpandLists() const
156 {
157   return this->CommandExpandLists;
158 }
159
160 void cmCustomCommand::SetCommandExpandLists(bool b)
161 {
162   this->CommandExpandLists = b;
163 }
164
165 const std::string& cmCustomCommand::GetDepfile() const
166 {
167   return this->Depfile;
168 }
169
170 void cmCustomCommand::SetDepfile(const std::string& depfile)
171 {
172   this->Depfile = depfile;
173 }
174
175 const std::string& cmCustomCommand::GetJobPool() const
176 {
177   return this->JobPool;
178 }
179
180 void cmCustomCommand::SetJobPool(const std::string& job_pool)
181 {
182   this->JobPool = job_pool;
183 }
184
185 cmPolicies::PolicyStatus cmCustomCommand::GetCMP0116Status() const
186 {
187   return this->CMP0116Status;
188 }
189
190 void cmCustomCommand::SetCMP0116Status(cmPolicies::PolicyStatus cmp0116)
191 {
192   this->CMP0116Status = cmp0116;
193 }
194
195 const std::string& cmCustomCommand::GetTarget() const
196 {
197   return this->Target;
198 }
199
200 void cmCustomCommand::SetTarget(const std::string& target)
201 {
202   this->Target = target;
203 }