cmCustomCommand.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmCustomCommand_h
  14. #define cmCustomCommand_h
  15. #include "cmStandardIncludes.h"
  16. /** \class cmCustomCommand
  17. * \brief A class to encapsulate a custom command
  18. *
  19. * cmCustomCommand encapsulates the properties of a custom command
  20. */
  21. class cmCustomCommand
  22. {
  23. public:
  24. /** Default and copy constructors for STL containers. */
  25. cmCustomCommand();
  26. cmCustomCommand(const cmCustomCommand& r);
  27. /** Main constructor specifies all information for the command. */
  28. cmCustomCommand(const std::vector<std::string>& outputs,
  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 working directory. */
  36. const char* GetWorkingDirectory() const;
  37. /** Get the vector that holds the list of dependencies. */
  38. const std::vector<std::string>& GetDepends() const;
  39. /** Get the list of command lines. */
  40. const cmCustomCommandLines& GetCommandLines() const;
  41. /** Get the comment string for the command. */
  42. const char* GetComment() const;
  43. /** Append to the list of command lines. */
  44. void AppendCommands(const cmCustomCommandLines& commandLines);
  45. /** Append to the list of dependencies. */
  46. void AppendDepends(const std::vector<std::string>& depends);
  47. /** Set/Get whether old-style escaping should be used. */
  48. bool GetEscapeOldStyle() const;
  49. void SetEscapeOldStyle(bool b);
  50. /** Set/Get whether the build tool can replace variables in
  51. arguments to the command. */
  52. bool GetEscapeAllowMakeVars() const;
  53. void SetEscapeAllowMakeVars(bool b);
  54. typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
  55. class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
  56. void SetImplicitDepends(ImplicitDependsList const&);
  57. void AppendImplicitDepends(ImplicitDependsList const&);
  58. ImplicitDependsList const& GetImplicitDepends() const;
  59. private:
  60. std::vector<std::string> Outputs;
  61. std::vector<std::string> Depends;
  62. cmCustomCommandLines CommandLines;
  63. bool HaveComment;
  64. std::string Comment;
  65. std::string WorkingDirectory;
  66. bool EscapeAllowMakeVars;
  67. bool EscapeOldStyle;
  68. ImplicitDependsList ImplicitDepends;
  69. };
  70. #endif