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);
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,
37 const char* workingDirectory);
41 /** Get the output file produced by the command. */
42 const std::vector<std::string>& GetOutputs() const;
44 /** Get the working directory. */
45 const char* GetWorkingDirectory() const;
47 /** Get the vector that holds the list of dependencies. */
48 const std::vector<std::string>& GetDepends() const;
50 /** Get the list of command lines. */
51 const cmCustomCommandLines& GetCommandLines() const;
53 /** Get the comment string for the command. */
54 const char* GetComment() const;
56 /** Append to the list of command lines. */
57 void AppendCommands(const cmCustomCommandLines& commandLines);
59 /** Append to the list of dependencies. */
60 void AppendDepends(const std::vector<std::string>& depends);
62 /** Set/Get whether old-style escaping should be used. */
63 bool GetEscapeOldStyle() const;
64 void SetEscapeOldStyle(bool b);
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);
71 /** Backtrace of the command that created this custom command. */
72 cmListFileBacktrace const& GetBacktrace() const;
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;
81 std::vector<std::string> Outputs;
82 std::vector<std::string> Depends;
83 cmCustomCommandLines CommandLines;
86 std::string WorkingDirectory;
87 bool EscapeAllowMakeVars;
89 cmListFileBacktrace* Backtrace;
90 ImplicitDependsList ImplicitDepends;