1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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
15 #include "cmStandardIncludes.h"
17 class cmListFileBacktrace;
19 /** \class cmCustomCommand
20 * \brief A class to encapsulate a custom command
22 * cmCustomCommand encapsulates the properties of a custom command
27 /** Default and copy constructors for STL containers. */
29 cmCustomCommand(const cmCustomCommand& r);
30 cmCustomCommand& operator=(cmCustomCommand const& r);
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,
38 const char* workingDirectory);
42 /** Get the output file produced by the command. */
43 const std::vector<std::string>& GetOutputs() const;
45 /** Get the working directory. */
46 const char* GetWorkingDirectory() const;
48 /** Get the vector that holds the list of dependencies. */
49 const std::vector<std::string>& GetDepends() const;
51 /** Get the list of command lines. */
52 const cmCustomCommandLines& GetCommandLines() const;
54 /** Get the comment string for the command. */
55 const char* GetComment() const;
57 /** Append to the list of command lines. */
58 void AppendCommands(const cmCustomCommandLines& commandLines);
60 /** Append to the list of dependencies. */
61 void AppendDepends(const std::vector<std::string>& depends);
63 /** Set/Get whether old-style escaping should be used. */
64 bool GetEscapeOldStyle() const;
65 void SetEscapeOldStyle(bool b);
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);
72 /** Backtrace of the command that created this custom command. */
73 cmListFileBacktrace const& GetBacktrace() const;
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;
82 std::vector<std::string> Outputs;
83 std::vector<std::string> Depends;
84 cmCustomCommandLines CommandLines;
87 std::string WorkingDirectory;
88 bool EscapeAllowMakeVars;
90 cmListFileBacktrace* Backtrace;
91 ImplicitDependsList ImplicitDepends;