1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCustomCommand.cxx,v $
6 Date: $Date: 2008-06-02 20:45:06 $
7 Version: $Revision: 1.26 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmCustomCommand.h"
19 //----------------------------------------------------------------------------
20 cmCustomCommand::cmCustomCommand()
22 this->HaveComment
= false;
23 this->EscapeOldStyle
= true;
24 this->EscapeAllowMakeVars
= false;
27 //----------------------------------------------------------------------------
28 cmCustomCommand::cmCustomCommand(const cmCustomCommand
& r
):
31 CommandLines(r
.CommandLines
),
32 HaveComment(r
.HaveComment
),
34 WorkingDirectory(r
.WorkingDirectory
),
35 EscapeAllowMakeVars(r
.EscapeAllowMakeVars
),
36 EscapeOldStyle(r
.EscapeOldStyle
)
40 //----------------------------------------------------------------------------
41 cmCustomCommand::cmCustomCommand(const std::vector
<std::string
>& outputs
,
42 const std::vector
<std::string
>& depends
,
43 const cmCustomCommandLines
& commandLines
,
45 const char* workingDirectory
):
48 CommandLines(commandLines
),
49 HaveComment(comment
?true:false),
50 Comment(comment
?comment
:""),
51 WorkingDirectory(workingDirectory
?workingDirectory
:""),
52 EscapeAllowMakeVars(false),
55 this->EscapeOldStyle
= true;
56 this->EscapeAllowMakeVars
= false;
59 //----------------------------------------------------------------------------
60 const std::vector
<std::string
>& cmCustomCommand::GetOutputs() const
65 //----------------------------------------------------------------------------
66 const char* cmCustomCommand::GetWorkingDirectory() const
68 if(this->WorkingDirectory
.size() == 0)
72 return this->WorkingDirectory
.c_str();
75 //----------------------------------------------------------------------------
76 const std::vector
<std::string
>& cmCustomCommand::GetDepends() const
81 //----------------------------------------------------------------------------
82 const cmCustomCommandLines
& cmCustomCommand::GetCommandLines() const
84 return this->CommandLines
;
87 //----------------------------------------------------------------------------
88 const char* cmCustomCommand::GetComment() const
90 const char* no_comment
= 0;
91 return this->HaveComment
? this->Comment
.c_str() : no_comment
;
94 //----------------------------------------------------------------------------
95 void cmCustomCommand::AppendCommands(const cmCustomCommandLines
& commandLines
)
97 for(cmCustomCommandLines::const_iterator i
=commandLines
.begin();
98 i
!= commandLines
.end(); ++i
)
100 this->CommandLines
.push_back(*i
);
104 //----------------------------------------------------------------------------
105 void cmCustomCommand::AppendDepends(const std::vector
<std::string
>& depends
)
107 for(std::vector
<std::string
>::const_iterator i
=depends
.begin();
108 i
!= depends
.end(); ++i
)
110 this->Depends
.push_back(*i
);
114 //----------------------------------------------------------------------------
115 bool cmCustomCommand::GetEscapeOldStyle() const
117 return this->EscapeOldStyle
;
120 //----------------------------------------------------------------------------
121 void cmCustomCommand::SetEscapeOldStyle(bool b
)
123 this->EscapeOldStyle
= b
;
126 //----------------------------------------------------------------------------
127 bool cmCustomCommand::GetEscapeAllowMakeVars() const
129 return this->EscapeAllowMakeVars
;
132 //----------------------------------------------------------------------------
133 void cmCustomCommand::SetEscapeAllowMakeVars(bool b
)
135 this->EscapeAllowMakeVars
= b
;
138 //----------------------------------------------------------------------------
139 cmCustomCommand::ImplicitDependsList
const&
140 cmCustomCommand::GetImplicitDepends() const
142 return this->ImplicitDepends
;
145 //----------------------------------------------------------------------------
146 void cmCustomCommand::SetImplicitDepends(ImplicitDependsList
const& l
)
148 this->ImplicitDepends
= l
;
151 //----------------------------------------------------------------------------
152 void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList
const& l
)
154 this->ImplicitDepends
.insert(this->ImplicitDepends
.end(),