cmAddCustomCommandCommand.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. * This determines if the command gets propagated down
  41. * to makefiles located in subdirectories.
  42. */
  43. virtual bool IsInherited() {return true;}
  44. /**
  45. * The name of the command as specified in CMakeList.txt.
  46. */
  47. virtual const char* GetName() {return "ADD_CUSTOM_COMMAND";}
  48. /**
  49. * Succinct documentation.
  50. */
  51. virtual const char* GetTerseDocumentation()
  52. {
  53. return "Add a custom build rule to the generated build system.";
  54. }
  55. /**
  56. * More documentation.
  57. */
  58. virtual const char* GetFullDocumentation()
  59. {
  60. return
  61. "There are two main signatures for ADD_CUSTOM_COMMAND "
  62. "The first signature is for adding a custom command "
  63. "to produce an output.\n"
  64. " ADD_CUSTOM_COMMAND(OUTPUT result\n"
  65. " COMMAND command\n"
  66. " [ARGS [args...]]\n"
  67. " [MAIN_DEPENDENCY depend]\n"
  68. " [DEPENDS [depends...]]\n"
  69. " [COMMENT comment])\n"
  70. "This defines a new command that can be executed during the build "
  71. "process. Note that MAIN_DEPENDENCY is completely optional and is "
  72. "used as a suggestion to visual studio about where to hang the "
  73. "custom command In makefile terms this creates a new target in the "
  74. "following form:\n"
  75. " OUTPUT: MAIN_DEPENDENCY DEPENDS\n"
  76. " COMMAND ARGS\n"
  77. "\n"
  78. "The second signature adds a custom command to a target "
  79. "such as a library or executable. This is useful for "
  80. "performing an operation before or after building the target "
  81. "\n"
  82. " ADD_CUSTOM_COMMAND(TARGET target\n"
  83. " PRE_BUILD | PRE_LINK | POST_BUILD\n"
  84. " COMMAND command\n"
  85. " [ARGS [args...]]\n"
  86. " [COMMENT comment])\n"
  87. "This defines a new command that will be associated with "
  88. "building the specified target. When the command will "
  89. "happen is determined by whether you specify\n"
  90. "PRE_BUILD - run before all other dependencies\n"
  91. "PRE_LINK - run after other dependencies\n"
  92. "POST_BUILD - run after the target has been built\n";
  93. }
  94. cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
  95. };
  96. /*
  97. target: normal depends
  98. pre rules
  99. normal rules
  100. post rules
  101. output1: source other depends
  102. rule
  103. output2: source other dpeends
  104. rule
  105. another option is
  106. output1: depends
  107. rule
  108. output2: depends
  109. rule
  110. use case1 - an executable that depending on args create diff output files
  111. */
  112. #endif