cmCustomCommand.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #include "cmListFileCache.h"
  14. class cmMakefile;
  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 const* mf,
  29. const std::vector<std::string>& outputs,
  30. const std::vector<std::string>& byproducts,
  31. const std::vector<std::string>& depends,
  32. const cmCustomCommandLines& commandLines,
  33. const char* comment,
  34. const char* workingDirectory);
  35. ~cmCustomCommand();
  36. /** Get the output file produced by the command. */
  37. const std::vector<std::string>& GetOutputs() const;
  38. /** Get the extra files produced by the command. */
  39. const std::vector<std::string>& GetByproducts() const;
  40. /** Get the vector that holds the list of dependencies. */
  41. const std::vector<std::string>& GetDepends() const;
  42. /** Get the working directory. */
  43. std::string const& GetWorkingDirectory() const
  44. { return this->WorkingDirectory; }
  45. /** Get the list of command lines. */
  46. const cmCustomCommandLines& GetCommandLines() const;
  47. /** Get the comment string for the command. */
  48. const char* GetComment() const;
  49. /** Append to the list of command lines. */
  50. void AppendCommands(const cmCustomCommandLines& commandLines);
  51. /** Append to the list of dependencies. */
  52. void AppendDepends(const std::vector<std::string>& depends);
  53. /** Set/Get whether old-style escaping should be used. */
  54. bool GetEscapeOldStyle() const;
  55. void SetEscapeOldStyle(bool b);
  56. /** Set/Get whether the build tool can replace variables in
  57. arguments to the command. */
  58. bool GetEscapeAllowMakeVars() const;
  59. void SetEscapeAllowMakeVars(bool b);
  60. /** Backtrace of the command that created this custom command. */
  61. cmListFileBacktrace const& GetBacktrace() const;
  62. typedef std::pair<std::string, std::string> ImplicitDependsPair;
  63. class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
  64. void SetImplicitDepends(ImplicitDependsList const&);
  65. void AppendImplicitDepends(ImplicitDependsList const&);
  66. ImplicitDependsList const& GetImplicitDepends() const;
  67. /** Set/Get whether this custom command should be given access to the
  68. real console (if possible). */
  69. bool GetUsesTerminal() const;
  70. void SetUsesTerminal(bool b);
  71. private:
  72. std::vector<std::string> Outputs;
  73. std::vector<std::string> Byproducts;
  74. std::vector<std::string> Depends;
  75. cmCustomCommandLines CommandLines;
  76. bool HaveComment;
  77. std::string Comment;
  78. std::string WorkingDirectory;
  79. bool EscapeAllowMakeVars;
  80. bool EscapeOldStyle;
  81. cmListFileBacktrace Backtrace;
  82. ImplicitDependsList ImplicitDepends;
  83. bool UsesTerminal;
  84. };
  85. #endif