cmAddCustomCommandCommand.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 cmAddCustomCommandCommand_h
  14. #define cmAddCustomCommandCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. /** \class cmAddCustomCommandCommand
  18. * \brief
  19. *
  20. * cmAddCustomCommandCommand defines a new command (rule) that can
  21. * be executed within the build process
  22. *
  23. */
  24. class cmAddCustomCommandCommand : public cmCommand
  25. {
  26. public:
  27. /**
  28. * This is a virtual constructor for the command.
  29. */
  30. virtual cmCommand* Clone()
  31. {
  32. return new cmAddCustomCommandCommand;
  33. }
  34. /**
  35. * This is called when the command is first encountered in
  36. * the CMakeLists.txt file.
  37. */
  38. virtual bool InitialPass(std::vector<std::string> const& args);
  39. /**
  40. * The name of the command as specified in CMakeList.txt.
  41. */
  42. virtual const char* GetName() {return "ADD_CUSTOM_COMMAND";}
  43. /**
  44. * Succinct documentation.
  45. */
  46. virtual const char* GetTerseDocumentation()
  47. {
  48. return "Add a custom build rule to the generated build system.";
  49. }
  50. /**
  51. * More documentation.
  52. */
  53. virtual const char* GetFullDocumentation()
  54. {
  55. return
  56. "There are two main signatures for ADD_CUSTOM_COMMAND "
  57. "The first signature is for adding a custom command "
  58. "to produce an output.\n"
  59. " ADD_CUSTOM_COMMAND(OUTPUT result\n"
  60. " COMMAND command\n"
  61. " [ARGS [args...]]\n"
  62. " [MAIN_DEPENDENCY depend]\n"
  63. " [DEPENDS [depends...]]\n"
  64. " [COMMENT comment])\n"
  65. "This defines a new command that can be executed during the build "
  66. "process. Note that MAIN_DEPENDENCY is completely optional and is "
  67. "used as a suggestion to visual studio about where to hang the "
  68. "custom command. In makefile terms this creates a new target in the "
  69. "following form:\n"
  70. " OUTPUT: MAIN_DEPENDENCY DEPENDS\n"
  71. " COMMAND ARGS\n"
  72. "The second signature adds a custom command to a target "
  73. "such as a library or executable. This is useful for "
  74. "performing an operation before or after building the target:\n"
  75. " ADD_CUSTOM_COMMAND(TARGET target\n"
  76. " PRE_BUILD | PRE_LINK | POST_BUILD\n"
  77. " COMMAND command\n"
  78. " [ARGS [args...]]\n"
  79. " [COMMENT comment])\n"
  80. "This defines a new command that will be associated with "
  81. "building the specified target. When the command will "
  82. "happen is determined by which of the following is specified:\n"
  83. " PRE_BUILD - run before all other dependencies\n"
  84. " PRE_LINK - run after other dependencies\n"
  85. " POST_BUILD - run after the target has been built";
  86. }
  87. cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
  88. };
  89. #endif