cmAddCustomCommandCommand.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 that can
  21. * be executed within the CMake
  22. *
  23. * In makefile terms this creates new target in the following form:
  24. * OUTPUT1: SOURCE DEPENDS
  25. * COMMAND ARGS
  26. * OUTPUT2: SOURCE DEPENDS
  27. * COMMAND ARGS
  28. * ...
  29. * Example of usage:
  30. * ADD_CUSTOM_COMMAND(
  31. * SOURCE ${VTK_TIFF_FAX_EXE}
  32. * COMMAND ${VTK_TIFF_FAX_EXE}
  33. * ARGS -c const ${VTK_BINARY_DIR}/Utilities/tiff/tif_fax3sm.c
  34. * TARGET vtktiff
  35. * OUTPUTS ${VTK_BINARY_DIR}/Utilities/tiff/tif_fax3sm.c
  36. * )
  37. * This will create custom target which will generate file tif_fax3sm.c
  38. * using command ${VTK_TIFF_FAX_EXE}.
  39. */
  40. class cmAddCustomCommandCommand : public cmCommand
  41. {
  42. public:
  43. /**
  44. * This is a virtual constructor for the command.
  45. */
  46. virtual cmCommand* Clone()
  47. {
  48. return new cmAddCustomCommandCommand;
  49. }
  50. /**
  51. * This is called when the command is first encountered in
  52. * the CMakeLists.txt file.
  53. */
  54. virtual bool InitialPass(std::vector<std::string> const& args);
  55. /**
  56. * This determines if the command gets propagated down
  57. * to makefiles located in subdirectories.
  58. */
  59. virtual bool IsInherited() {return true;}
  60. /**
  61. * The name of the command as specified in CMakeList.txt.
  62. */
  63. virtual const char* GetName() {return "ADD_CUSTOM_COMMAND";}
  64. /**
  65. * Succinct documentation.
  66. */
  67. virtual const char* GetTerseDocumentation()
  68. {
  69. return "Create new command within CMake.";
  70. }
  71. /**
  72. * More documentation.
  73. */
  74. virtual const char* GetFullDocumentation()
  75. {
  76. return
  77. "ADD_CUSTOM_COMMAND(SOURCE source COMMAND command TARGET target "
  78. "[ARGS [args...]] [DEPENDS [depends...]] [OUTPUTS [outputs...]])\n"
  79. "Add a custom command.";
  80. }
  81. cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
  82. };
  83. #endif