cmCustomCommand.h 3.2 KB

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