packaging: Initial packaging
[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   cmCustomCommand& operator=(cmCustomCommand const& r);
31
32   /** Main constructor specifies all information for the command.  */
33   cmCustomCommand(cmMakefile* mf,
34                   const std::vector<std::string>& outputs,
35                   const std::vector<std::string>& depends,
36                   const cmCustomCommandLines& commandLines,
37                   const char* comment,
38                   const char* workingDirectory);
39
40   ~cmCustomCommand();
41
42   /** Get the output file produced by the command.  */
43   const std::vector<std::string>& GetOutputs() const;
44
45   /** Get the working directory.  */
46   const char* GetWorkingDirectory() const;
47
48   /** Get the vector that holds the list of dependencies.  */
49   const std::vector<std::string>& GetDepends() const;
50
51   /** Get the list of command lines.  */
52   const cmCustomCommandLines& GetCommandLines() const;
53
54   /** Get the comment string for the command.  */
55   const char* GetComment() const;
56
57   /** Append to the list of command lines.  */
58   void AppendCommands(const cmCustomCommandLines& commandLines);
59
60   /** Append to the list of dependencies.  */
61   void AppendDepends(const std::vector<std::string>& depends);
62
63   /** Set/Get whether old-style escaping should be used.  */
64   bool GetEscapeOldStyle() const;
65   void SetEscapeOldStyle(bool b);
66
67   /** Set/Get whether the build tool can replace variables in
68       arguments to the command.  */
69   bool GetEscapeAllowMakeVars() const;
70   void SetEscapeAllowMakeVars(bool b);
71
72   /** Backtrace of the command that created this custom command.  */
73   cmListFileBacktrace const& GetBacktrace() const;
74
75   typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
76   class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
77   void SetImplicitDepends(ImplicitDependsList const&);
78   void AppendImplicitDepends(ImplicitDependsList const&);
79   ImplicitDependsList const& GetImplicitDepends() const;
80
81 private:
82   std::vector<std::string> Outputs;
83   std::vector<std::string> Depends;
84   cmCustomCommandLines CommandLines;
85   bool HaveComment;
86   std::string Comment;
87   std::string WorkingDirectory;
88   bool EscapeAllowMakeVars;
89   bool EscapeOldStyle;
90   cmListFileBacktrace* Backtrace;
91   ImplicitDependsList ImplicitDepends;
92 };
93
94 #endif