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 <utility>
6 
7 #include <cmext/algorithm>
8 
cmCustomCommand(std::vector<std::string> outputs,std::vector<std::string> byproducts,std::vector<std::string> depends,cmCustomCommandLines commandLines,cmListFileBacktrace lfbt,const char * comment,const char * workingDirectory,bool stdPipesUTF8)9 cmCustomCommand::cmCustomCommand(std::vector<std::string> outputs,
10                                  std::vector<std::string> byproducts,
11                                  std::vector<std::string> depends,
12                                  cmCustomCommandLines commandLines,
13                                  cmListFileBacktrace lfbt, const char* comment,
14                                  const char* workingDirectory,
15                                  bool stdPipesUTF8)
16   : Outputs(std::move(outputs))
17   , Byproducts(std::move(byproducts))
18   , Depends(std::move(depends))
19   , CommandLines(std::move(commandLines))
20   , Backtrace(std::move(lfbt))
21   , Comment(comment ? comment : "")
22   , WorkingDirectory(workingDirectory ? workingDirectory : "")
23   , HaveComment(comment != nullptr)
24   , StdPipesUTF8(stdPipesUTF8)
25 {
26 }
27 
GetOutputs() const28 const std::vector<std::string>& cmCustomCommand::GetOutputs() const
29 {
30   return this->Outputs;
31 }
32 
GetByproducts() const33 const std::vector<std::string>& cmCustomCommand::GetByproducts() const
34 {
35   return this->Byproducts;
36 }
37 
GetDepends() const38 const std::vector<std::string>& cmCustomCommand::GetDepends() const
39 {
40   return this->Depends;
41 }
42 
GetCommandLines() const43 const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
44 {
45   return this->CommandLines;
46 }
47 
GetComment() const48 const char* cmCustomCommand::GetComment() const
49 {
50   const char* no_comment = nullptr;
51   return this->HaveComment ? this->Comment.c_str() : no_comment;
52 }
53 
AppendCommands(const cmCustomCommandLines & commandLines)54 void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
55 {
56   cm::append(this->CommandLines, commandLines);
57 }
58 
AppendDepends(const std::vector<std::string> & depends)59 void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
60 {
61   cm::append(this->Depends, depends);
62 }
63 
GetEscapeOldStyle() const64 bool cmCustomCommand::GetEscapeOldStyle() const
65 {
66   return this->EscapeOldStyle;
67 }
68 
SetEscapeOldStyle(bool b)69 void cmCustomCommand::SetEscapeOldStyle(bool b)
70 {
71   this->EscapeOldStyle = b;
72 }
73 
GetEscapeAllowMakeVars() const74 bool cmCustomCommand::GetEscapeAllowMakeVars() const
75 {
76   return this->EscapeAllowMakeVars;
77 }
78 
SetEscapeAllowMakeVars(bool b)79 void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
80 {
81   this->EscapeAllowMakeVars = b;
82 }
83 
GetBacktrace() const84 cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
85 {
86   return this->Backtrace;
87 }
88 
GetImplicitDepends() const89 cmImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const
90 {
91   return this->ImplicitDepends;
92 }
93 
SetImplicitDepends(cmImplicitDependsList const & l)94 void cmCustomCommand::SetImplicitDepends(cmImplicitDependsList const& l)
95 {
96   this->ImplicitDepends = l;
97 }
98 
AppendImplicitDepends(cmImplicitDependsList const & l)99 void cmCustomCommand::AppendImplicitDepends(cmImplicitDependsList const& l)
100 {
101   cm::append(this->ImplicitDepends, l);
102 }
103 
GetUsesTerminal() const104 bool cmCustomCommand::GetUsesTerminal() const
105 {
106   return this->UsesTerminal;
107 }
108 
SetUsesTerminal(bool b)109 void cmCustomCommand::SetUsesTerminal(bool b)
110 {
111   this->UsesTerminal = b;
112 }
113 
GetCommandExpandLists() const114 bool cmCustomCommand::GetCommandExpandLists() const
115 {
116   return this->CommandExpandLists;
117 }
118 
SetCommandExpandLists(bool b)119 void cmCustomCommand::SetCommandExpandLists(bool b)
120 {
121   this->CommandExpandLists = b;
122 }
123 
GetDepfile() const124 const std::string& cmCustomCommand::GetDepfile() const
125 {
126   return this->Depfile;
127 }
128 
SetDepfile(const std::string & depfile)129 void cmCustomCommand::SetDepfile(const std::string& depfile)
130 {
131   this->Depfile = depfile;
132 }
133 
GetJobPool() const134 const std::string& cmCustomCommand::GetJobPool() const
135 {
136   return this->JobPool;
137 }
138 
SetJobPool(const std::string & job_pool)139 void cmCustomCommand::SetJobPool(const std::string& job_pool)
140 {
141   this->JobPool = job_pool;
142 }
143 
GetCMP0116Status() const144 cmPolicies::PolicyStatus cmCustomCommand::GetCMP0116Status() const
145 {
146   return this->CMP0116Status;
147 }
148 
SetCMP0116Status(cmPolicies::PolicyStatus cmp0116)149 void cmCustomCommand::SetCMP0116Status(cmPolicies::PolicyStatus cmp0116)
150 {
151   this->CMP0116Status = cmp0116;
152 }
153 
GetTarget() const154 const std::string& cmCustomCommand::GetTarget() const
155 {
156   return this->Target;
157 }
158 
SetTarget(const std::string & target)159 void cmCustomCommand::SetTarget(const std::string& target)
160 {
161   this->Target = target;
162 }
163