cmCustomCommand.h 3.5 KB

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