Introduce "generator expressions" to add_test()
[cmake.git] / Source / cmCustomCommand.cxx
blob44efd7753877bcfbae0b2e931d409ecd396fbf16
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCustomCommand.cxx,v $
5 Language: C++
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):
29 Outputs(r.Outputs),
30 Depends(r.Depends),
31 CommandLines(r.CommandLines),
32 HaveComment(r.HaveComment),
33 Comment(r.Comment),
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,
44 const char* comment,
45 const char* workingDirectory):
46 Outputs(outputs),
47 Depends(depends),
48 CommandLines(commandLines),
49 HaveComment(comment?true:false),
50 Comment(comment?comment:""),
51 WorkingDirectory(workingDirectory?workingDirectory:""),
52 EscapeAllowMakeVars(false),
53 EscapeOldStyle(true)
55 this->EscapeOldStyle = true;
56 this->EscapeAllowMakeVars = false;
59 //----------------------------------------------------------------------------
60 const std::vector<std::string>& cmCustomCommand::GetOutputs() const
62 return this->Outputs;
65 //----------------------------------------------------------------------------
66 const char* cmCustomCommand::GetWorkingDirectory() const
68 if(this->WorkingDirectory.size() == 0)
70 return 0;
72 return this->WorkingDirectory.c_str();
75 //----------------------------------------------------------------------------
76 const std::vector<std::string>& cmCustomCommand::GetDepends() const
78 return this->Depends;
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(),
155 l.begin(), l.end());