/src/CMake/Source/cmCustomCommand.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst 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 | | #include "cmStateSnapshot.h" |
11 | | |
12 | | std::vector<std::string> const& cmCustomCommand::GetOutputs() const |
13 | 5.92k | { |
14 | 5.92k | return this->Outputs; |
15 | 5.92k | } |
16 | | |
17 | | void cmCustomCommand::SetOutputs(std::vector<std::string> outputs) |
18 | 0 | { |
19 | 0 | this->Outputs = std::move(outputs); |
20 | 0 | } |
21 | | |
22 | | void cmCustomCommand::SetOutputs(std::string output) |
23 | 5.92k | { |
24 | 5.92k | this->Outputs = { std::move(output) }; |
25 | 5.92k | } |
26 | | |
27 | | std::vector<std::string> const& cmCustomCommand::GetByproducts() const |
28 | 17.7k | { |
29 | 17.7k | return this->Byproducts; |
30 | 17.7k | } |
31 | | |
32 | | void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts) |
33 | 5.92k | { |
34 | 5.92k | this->Byproducts = std::move(byproducts); |
35 | 5.92k | } |
36 | | |
37 | | std::vector<std::string> const& cmCustomCommand::GetDepends() const |
38 | 5.92k | { |
39 | 5.92k | return this->Depends; |
40 | 5.92k | } |
41 | | |
42 | | void cmCustomCommand::SetDepends(std::vector<std::string> depends) |
43 | 5.92k | { |
44 | 5.92k | if (this->HasMainDependency_) { |
45 | 0 | depends.insert(depends.begin(), std::move(this->Depends[0])); |
46 | 0 | } |
47 | | |
48 | 5.92k | Depends = std::move(depends); |
49 | 5.92k | } |
50 | | |
51 | | std::string const& cmCustomCommand::GetMainDependency() const |
52 | 0 | { |
53 | 0 | assert(this->HasMainDependency_); |
54 | 0 | return this->Depends[0]; |
55 | 0 | } |
56 | | |
57 | | void cmCustomCommand::SetMainDependency(std::string main_dependency) |
58 | 0 | { |
59 | 0 | if (this->HasMainDependency_) { |
60 | 0 | assert(!main_dependency.empty()); |
61 | 0 | this->Depends[0] = std::move(main_dependency); |
62 | 0 | } else if (main_dependency.empty()) { |
63 | | // Do nothing. |
64 | 0 | } else { |
65 | 0 | this->Depends.insert(this->Depends.begin(), std::move(main_dependency)); |
66 | 0 | this->HasMainDependency_ = true; |
67 | 0 | } |
68 | 0 | } |
69 | | |
70 | | cmCustomCommandLines const& cmCustomCommand::GetCommandLines() const |
71 | 11.8k | { |
72 | 11.8k | return this->CommandLines; |
73 | 11.8k | } |
74 | | |
75 | | void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines) |
76 | 5.92k | { |
77 | 5.92k | this->CommandLines = std::move(commandLines); |
78 | 5.92k | } |
79 | | |
80 | | cm::optional<std::string> const& cmCustomCommand::GetComment() const |
81 | 5.92k | { |
82 | 5.92k | return this->Comment; |
83 | 5.92k | } |
84 | | |
85 | | void cmCustomCommand::SetComment(cm::optional<std::string> comment) |
86 | 11.8k | { |
87 | 11.8k | this->Comment = std::move(comment); |
88 | 11.8k | } |
89 | | |
90 | | void cmCustomCommand::AppendCommands(cmCustomCommandLines const& commandLines) |
91 | 0 | { |
92 | 0 | cm::append(this->CommandLines, commandLines); |
93 | 0 | } |
94 | | |
95 | | void cmCustomCommand::AppendDepends(std::vector<std::string> const& depends) |
96 | 0 | { |
97 | 0 | cm::append(this->Depends, depends); |
98 | 0 | } |
99 | | |
100 | | bool cmCustomCommand::GetEscapeOldStyle() const |
101 | 0 | { |
102 | 0 | return this->EscapeOldStyle; |
103 | 0 | } |
104 | | |
105 | | void cmCustomCommand::SetEscapeOldStyle(bool b) |
106 | 5.92k | { |
107 | 5.92k | this->EscapeOldStyle = b; |
108 | 5.92k | } |
109 | | |
110 | | bool cmCustomCommand::GetEscapeAllowMakeVars() const |
111 | 0 | { |
112 | 0 | return this->EscapeAllowMakeVars; |
113 | 0 | } |
114 | | |
115 | | void cmCustomCommand::SetEscapeAllowMakeVars(bool b) |
116 | 5.92k | { |
117 | 5.92k | this->EscapeAllowMakeVars = b; |
118 | 5.92k | } |
119 | | |
120 | | cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const |
121 | 11.8k | { |
122 | 11.8k | return this->Backtrace; |
123 | 11.8k | } |
124 | | |
125 | | void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt) |
126 | 5.92k | { |
127 | 5.92k | this->Backtrace = std::move(lfbt); |
128 | 5.92k | } |
129 | | |
130 | | cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const |
131 | 0 | { |
132 | 0 | return this->ImplicitDepends; |
133 | 0 | } |
134 | | |
135 | | void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l) |
136 | 0 | { |
137 | 0 | this->ImplicitDepends = l; |
138 | 0 | } |
139 | | |
140 | | void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l) |
141 | 0 | { |
142 | 0 | cm::append(this->ImplicitDepends, l); |
143 | 0 | } |
144 | | |
145 | | bool cmCustomCommand::GetUsesTerminal() const |
146 | 0 | { |
147 | 0 | return this->UsesTerminal; |
148 | 0 | } |
149 | | |
150 | | void cmCustomCommand::SetUsesTerminal(bool b) |
151 | 5.92k | { |
152 | 5.92k | this->UsesTerminal = b; |
153 | 5.92k | } |
154 | | |
155 | | void cmCustomCommand::SetRole(std::string const& role) |
156 | 0 | { |
157 | 0 | this->Role = role; |
158 | 0 | } |
159 | | |
160 | | std::string const& cmCustomCommand::GetRole() const |
161 | 0 | { |
162 | 0 | return this->Role; |
163 | 0 | } |
164 | | |
165 | | bool cmCustomCommand::GetCommandExpandLists() const |
166 | 0 | { |
167 | 0 | return this->CommandExpandLists; |
168 | 0 | } |
169 | | |
170 | | void cmCustomCommand::SetCommandExpandLists(bool b) |
171 | 5.92k | { |
172 | 5.92k | this->CommandExpandLists = b; |
173 | 5.92k | } |
174 | | |
175 | | bool cmCustomCommand::GetDependsExplicitOnly() const |
176 | 0 | { |
177 | 0 | return this->DependsExplicitOnly; |
178 | 0 | } |
179 | | |
180 | | void cmCustomCommand::SetDependsExplicitOnly(bool b) |
181 | 0 | { |
182 | 0 | this->DependsExplicitOnly = b; |
183 | 0 | } |
184 | | |
185 | | std::string const& cmCustomCommand::GetDepfile() const |
186 | 0 | { |
187 | 0 | return this->Depfile; |
188 | 0 | } |
189 | | |
190 | | void cmCustomCommand::SetDepfile(std::string const& depfile) |
191 | 0 | { |
192 | 0 | this->Depfile = depfile; |
193 | 0 | } |
194 | | |
195 | | std::string const& cmCustomCommand::GetJobPool() const |
196 | 0 | { |
197 | 0 | return this->JobPool; |
198 | 0 | } |
199 | | |
200 | | void cmCustomCommand::SetJobPool(std::string const& job_pool) |
201 | 5.92k | { |
202 | 5.92k | this->JobPool = job_pool; |
203 | 5.92k | } |
204 | | |
205 | | bool cmCustomCommand::GetJobserverAware() const |
206 | 0 | { |
207 | 0 | return this->JobserverAware; |
208 | 0 | } |
209 | | |
210 | | void cmCustomCommand::SetJobserverAware(bool b) |
211 | 5.92k | { |
212 | 5.92k | this->JobserverAware = b; |
213 | 5.92k | } |
214 | | |
215 | | #define DEFINE_CC_POLICY_ACCESSOR(P) \ |
216 | | cmPolicies::PolicyStatus cmCustomCommand::Get##P##Status() const \ |
217 | 0 | { \ |
218 | 0 | return this->P##Status; \ |
219 | 0 | } Unexecuted instantiation: cmCustomCommand::GetCMP0116Status() const Unexecuted instantiation: cmCustomCommand::GetCMP0147Status() const Unexecuted instantiation: cmCustomCommand::GetCMP0212Status() const |
220 | | CM_FOR_EACH_CUSTOM_COMMAND_POLICY(DEFINE_CC_POLICY_ACCESSOR) |
221 | | #undef DEFINE_CC_POLICY_ACCESSOR |
222 | | |
223 | 5.92k | void cmCustomCommand::RecordPolicyValues(cmStateSnapshot const& snapshot){ |
224 | 17.7k | #define SET_CC_POLICY(P) this->P##Status = snapshot.GetPolicy(cmPolicies::P); |
225 | 17.7k | CM_FOR_EACH_CUSTOM_COMMAND_POLICY(SET_CC_POLICY) |
226 | 5.92k | #undef SET_CC_POLICY |
227 | 5.92k | } |
228 | | |
229 | | std::string const& cmCustomCommand::GetTarget() const |
230 | 0 | { |
231 | 0 | return this->Target; |
232 | 0 | } |
233 | | |
234 | | void cmCustomCommand::SetTarget(std::string const& target) |
235 | 0 | { |
236 | 0 | this->Target = target; |
237 | 0 | } |