cmCustomCommand.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 cmCustomCommand
  14. * \brief A class to encapsulate a custom command
  15. *
  16. * cmCustomCommand encapsulates the properties of a custom command
  17. */
  18. class cmCustomCommand
  19. {
  20. public:
  21. /** Default and copy constructors for STL containers. */
  22. cmCustomCommand();
  23. cmCustomCommand(const cmCustomCommand& r);
  24. /** Main constructor specifies all information for the command. */
  25. cmCustomCommand(const std::vector<std::string>& outputs,
  26. const std::vector<std::string>& depends,
  27. const cmCustomCommandLines& commandLines,
  28. const char* comment,
  29. const char* workingDirectory);
  30. /** Get the output file produced by the command. */
  31. const std::vector<std::string>& GetOutputs() const;
  32. /** Get the working directory. */
  33. const char* GetWorkingDirectory() const;
  34. /** Get the vector that holds the list of dependencies. */
  35. const std::vector<std::string>& GetDepends() const;
  36. /** Get the list of command lines. */
  37. const cmCustomCommandLines& GetCommandLines() const;
  38. /** Get the comment string for the command. */
  39. const char* GetComment() const;
  40. /** Append to the list of command lines. */
  41. void AppendCommands(const cmCustomCommandLines& commandLines);
  42. /** Append to the list of dependencies. */
  43. void AppendDepends(const std::vector<std::string>& depends);
  44. /** Set/Get whether old-style escaping should be used. */
  45. bool GetEscapeOldStyle() const;
  46. void SetEscapeOldStyle(bool b);
  47. /** Set/Get whether the build tool can replace variables in
  48. arguments to the command. */
  49. bool GetEscapeAllowMakeVars() const;
  50. void SetEscapeAllowMakeVars(bool b);
  51. typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
  52. class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
  53. void SetImplicitDepends(ImplicitDependsList const&);
  54. void AppendImplicitDepends(ImplicitDependsList const&);
  55. ImplicitDependsList const& GetImplicitDepends() const;
  56. private:
  57. std::vector<std::string> Outputs;
  58. std::vector<std::string> Depends;
  59. cmCustomCommandLines CommandLines;
  60. bool HaveComment;
  61. std::string Comment;
  62. std::string WorkingDirectory;
  63. bool EscapeAllowMakeVars;
  64. bool EscapeOldStyle;
  65. ImplicitDependsList ImplicitDepends;
  66. };
  67. #endif