Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmCustomCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmCustomCommand_h
13 #define cmCustomCommand_h
14
15 #include "cmStandardIncludes.h"
16 class cmMakefile;
17 class cmListFileBacktrace;
18
19 /** \class cmCustomCommand
20  * \brief A class to encapsulate a custom command
21  *
22  * cmCustomCommand encapsulates the properties of a custom command
23  */
24 class cmCustomCommand
25 {
26 public:
27   /** Default and copy constructors for STL containers.  */
28   cmCustomCommand();
29   cmCustomCommand(const cmCustomCommand& r);
30
31   /** Main constructor specifies all information for the command.  */
32   cmCustomCommand(cmMakefile* mf,
33                   const std::vector<std::string>& outputs,
34                   const std::vector<std::string>& depends,
35                   const cmCustomCommandLines& commandLines,
36                   const char* comment,
37                   const char* workingDirectory);
38
39   ~cmCustomCommand();
40
41   /** Get the output file produced by the command.  */
42   const std::vector<std::string>& GetOutputs() const;
43
44   /** Get the working directory.  */
45   const char* GetWorkingDirectory() const;
46
47   /** Get the vector that holds the list of dependencies.  */
48   const std::vector<std::string>& GetDepends() const;
49
50   /** Get the list of command lines.  */
51   const cmCustomCommandLines& GetCommandLines() const;
52
53   /** Get the comment string for the command.  */
54   const char* GetComment() const;
55
56   /** Append to the list of command lines.  */
57   void AppendCommands(const cmCustomCommandLines& commandLines);
58
59   /** Append to the list of dependencies.  */
60   void AppendDepends(const std::vector<std::string>& depends);
61
62   /** Set/Get whether old-style escaping should be used.  */
63   bool GetEscapeOldStyle() const;
64   void SetEscapeOldStyle(bool b);
65
66   /** Set/Get whether the build tool can replace variables in
67       arguments to the command.  */
68   bool GetEscapeAllowMakeVars() const;
69   void SetEscapeAllowMakeVars(bool b);
70
71   /** Backtrace of the command that created this custom command.  */
72   cmListFileBacktrace const& GetBacktrace() const;
73
74   typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
75   class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
76   void SetImplicitDepends(ImplicitDependsList const&);
77   void AppendImplicitDepends(ImplicitDependsList const&);
78   ImplicitDependsList const& GetImplicitDepends() const;
79
80 private:
81   std::vector<std::string> Outputs;
82   std::vector<std::string> Depends;
83   cmCustomCommandLines CommandLines;
84   bool HaveComment;
85   std::string Comment;
86   std::string WorkingDirectory;
87   bool EscapeAllowMakeVars;
88   bool EscapeOldStyle;
89   cmListFileBacktrace* Backtrace;
90   ImplicitDependsList ImplicitDepends;
91 };
92
93 #endif