/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 | 0 | { |
14 | 0 | return this->Outputs; |
15 | 0 | } |
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 | 0 | { |
24 | 0 | this->Outputs = { std::move(output) }; |
25 | 0 | } |
26 | | |
27 | | std::vector<std::string> const& cmCustomCommand::GetByproducts() const |
28 | 0 | { |
29 | 0 | return this->Byproducts; |
30 | 0 | } |
31 | | |
32 | | void cmCustomCommand::SetByproducts(std::vector<std::string> byproducts) |
33 | 0 | { |
34 | 0 | this->Byproducts = std::move(byproducts); |
35 | 0 | } |
36 | | |
37 | | std::vector<std::string> const& cmCustomCommand::GetDepends() const |
38 | 0 | { |
39 | 0 | return this->Depends; |
40 | 0 | } |
41 | | |
42 | | void cmCustomCommand::SetDepends(std::vector<std::string> depends) |
43 | 0 | { |
44 | 0 | if (this->HasMainDependency_) { |
45 | 0 | depends.insert(depends.begin(), std::move(this->Depends[0])); |
46 | 0 | } |
47 | |
|
48 | 0 | Depends = std::move(depends); |
49 | 0 | } |
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 | 0 | { |
72 | 0 | return this->CommandLines; |
73 | 0 | } |
74 | | |
75 | | void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines) |
76 | 0 | { |
77 | 0 | this->CommandLines = std::move(commandLines); |
78 | 0 | } |
79 | | |
80 | | char const* cmCustomCommand::GetComment() const |
81 | 0 | { |
82 | 0 | char const* no_comment = nullptr; |
83 | 0 | return this->HaveComment ? this->Comment.c_str() : no_comment; |
84 | 0 | } |
85 | | |
86 | | void cmCustomCommand::SetComment(char const* comment) |
87 | 0 | { |
88 | 0 | this->Comment = comment ? comment : ""; |
89 | 0 | this->HaveComment = (comment != nullptr); |
90 | 0 | } |
91 | | |
92 | | void cmCustomCommand::AppendCommands(cmCustomCommandLines const& commandLines) |
93 | 0 | { |
94 | 0 | cm::append(this->CommandLines, commandLines); |
95 | 0 | } |
96 | | |
97 | | void cmCustomCommand::AppendDepends(std::vector<std::string> const& depends) |
98 | 0 | { |
99 | 0 | cm::append(this->Depends, depends); |
100 | 0 | } |
101 | | |
102 | | bool cmCustomCommand::GetEscapeOldStyle() const |
103 | 0 | { |
104 | 0 | return this->EscapeOldStyle; |
105 | 0 | } |
106 | | |
107 | | void cmCustomCommand::SetEscapeOldStyle(bool b) |
108 | 0 | { |
109 | 0 | this->EscapeOldStyle = b; |
110 | 0 | } |
111 | | |
112 | | bool cmCustomCommand::GetEscapeAllowMakeVars() const |
113 | 0 | { |
114 | 0 | return this->EscapeAllowMakeVars; |
115 | 0 | } |
116 | | |
117 | | void cmCustomCommand::SetEscapeAllowMakeVars(bool b) |
118 | 0 | { |
119 | 0 | this->EscapeAllowMakeVars = b; |
120 | 0 | } |
121 | | |
122 | | cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const |
123 | 0 | { |
124 | 0 | return this->Backtrace; |
125 | 0 | } |
126 | | |
127 | | void cmCustomCommand::SetBacktrace(cmListFileBacktrace lfbt) |
128 | 0 | { |
129 | 0 | this->Backtrace = std::move(lfbt); |
130 | 0 | } |
131 | | |
132 | | cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const |
133 | 0 | { |
134 | 0 | return this->ImplicitDepends; |
135 | 0 | } |
136 | | |
137 | | void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l) |
138 | 0 | { |
139 | 0 | this->ImplicitDepends = l; |
140 | 0 | } |
141 | | |
142 | | void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l) |
143 | 0 | { |
144 | 0 | cm::append(this->ImplicitDepends, l); |
145 | 0 | } |
146 | | |
147 | | bool cmCustomCommand::GetUsesTerminal() const |
148 | 0 | { |
149 | 0 | return this->UsesTerminal; |
150 | 0 | } |
151 | | |
152 | | void cmCustomCommand::SetUsesTerminal(bool b) |
153 | 0 | { |
154 | 0 | this->UsesTerminal = b; |
155 | 0 | } |
156 | | |
157 | | void cmCustomCommand::SetRole(std::string const& role) |
158 | 0 | { |
159 | 0 | this->Role = role; |
160 | 0 | } |
161 | | |
162 | | std::string const& cmCustomCommand::GetRole() const |
163 | 0 | { |
164 | 0 | return this->Role; |
165 | 0 | } |
166 | | |
167 | | bool cmCustomCommand::GetCommandExpandLists() const |
168 | 0 | { |
169 | 0 | return this->CommandExpandLists; |
170 | 0 | } |
171 | | |
172 | | void cmCustomCommand::SetCommandExpandLists(bool b) |
173 | 0 | { |
174 | 0 | this->CommandExpandLists = b; |
175 | 0 | } |
176 | | |
177 | | bool cmCustomCommand::GetDependsExplicitOnly() const |
178 | 0 | { |
179 | 0 | return this->DependsExplicitOnly; |
180 | 0 | } |
181 | | |
182 | | void cmCustomCommand::SetDependsExplicitOnly(bool b) |
183 | 0 | { |
184 | 0 | this->DependsExplicitOnly = b; |
185 | 0 | } |
186 | | |
187 | | std::string const& cmCustomCommand::GetDepfile() const |
188 | 0 | { |
189 | 0 | return this->Depfile; |
190 | 0 | } |
191 | | |
192 | | void cmCustomCommand::SetDepfile(std::string const& depfile) |
193 | 0 | { |
194 | 0 | this->Depfile = depfile; |
195 | 0 | } |
196 | | |
197 | | std::string const& cmCustomCommand::GetJobPool() const |
198 | 0 | { |
199 | 0 | return this->JobPool; |
200 | 0 | } |
201 | | |
202 | | void cmCustomCommand::SetJobPool(std::string const& job_pool) |
203 | 0 | { |
204 | 0 | this->JobPool = job_pool; |
205 | 0 | } |
206 | | |
207 | | bool cmCustomCommand::GetJobserverAware() const |
208 | 0 | { |
209 | 0 | return this->JobserverAware; |
210 | 0 | } |
211 | | |
212 | | void cmCustomCommand::SetJobserverAware(bool b) |
213 | 0 | { |
214 | 0 | this->JobserverAware = b; |
215 | 0 | } |
216 | | |
217 | | #define DEFINE_CC_POLICY_ACCESSOR(P) \ |
218 | | cmPolicies::PolicyStatus cmCustomCommand::Get##P##Status() const \ |
219 | 0 | { \ |
220 | 0 | return this->P##Status; \ |
221 | 0 | } Unexecuted instantiation: cmCustomCommand::GetCMP0116Status() const Unexecuted instantiation: cmCustomCommand::GetCMP0147Status() const |
222 | | CM_FOR_EACH_CUSTOM_COMMAND_POLICY(DEFINE_CC_POLICY_ACCESSOR) |
223 | | #undef DEFINE_CC_POLICY_ACCESSOR |
224 | | |
225 | 0 | void cmCustomCommand::RecordPolicyValues(cmStateSnapshot const& snapshot){ |
226 | 0 | #define SET_CC_POLICY(P) this->P##Status = snapshot.GetPolicy(cmPolicies::P); |
227 | 0 | CM_FOR_EACH_CUSTOM_COMMAND_POLICY(SET_CC_POLICY) |
228 | 0 | #undef SET_CC_POLICY |
229 | 0 | } |
230 | | |
231 | | std::string const& cmCustomCommand::GetTarget() const |
232 | 0 | { |
233 | 0 | return this->Target; |
234 | 0 | } |
235 | | |
236 | | void cmCustomCommand::SetTarget(std::string const& target) |
237 | 0 | { |
238 | 0 | this->Target = target; |
239 | 0 | } |