cmAddCustomCommandCommand.h 2.4 KB

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