cmCustomCommand.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 const* 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 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. private:
  65. std::vector<std::string> Outputs;
  66. std::vector<std::string> Depends;
  67. cmCustomCommandLines CommandLines;
  68. bool HaveComment;
  69. std::string Comment;
  70. std::string WorkingDirectory;
  71. bool EscapeAllowMakeVars;
  72. bool EscapeOldStyle;
  73. cmListFileBacktrace* Backtrace;
  74. ImplicitDependsList ImplicitDepends;
  75. };
  76. #endif