cmExecProgramCommand.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 cmExecProgramCommand_h
  14. #define cmExecProgramCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. /** \class cmExecProgramCommand
  18. * \brief Command that adds a target to the build system.
  19. *
  20. * cmExecProgramCommand adds an extra target to the build system.
  21. * This is useful when you would like to add special
  22. * targets like "install,", "clean," and so on.
  23. */
  24. class cmExecProgramCommand : public cmCommand
  25. {
  26. public:
  27. /**
  28. * This is a virtual constructor for the command.
  29. */
  30. virtual cmCommand* Clone()
  31. {
  32. return new cmExecProgramCommand;
  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()
  43. {return "EXEC_PROGRAM";}
  44. /**
  45. * Succinct documentation.
  46. */
  47. virtual const char* GetTerseDocumentation()
  48. {
  49. return "Run and executable program during the processing of the CMakeList.txt file.";
  50. }
  51. /**
  52. * More documentation.
  53. */
  54. virtual const char* GetFullDocumentation()
  55. {
  56. return
  57. " EXEC_PROGRAM(Executable [directory in which to run]\n"
  58. " [ARGS <arguments to executable>]\n"
  59. " [OUTPUT_VARIABLE <var>]\n"
  60. " [RETURN_VALUE <var>])\n"
  61. "The executable is run in the optionally specified Directory. The "
  62. "executable can include arguments if it is double quoted, but it is "
  63. "better to use the optional ARGS argument to specify arguments to the "
  64. "program. This is because cmake will then be able to escape spaces "
  65. "in the Executable path. An optional argument OUTPUT_VARIABLE "
  66. "specifies a variable in which to store the output. "
  67. "To capture the return value of the execution, use RETURN_VALUE variable. "
  68. "If OUTPUT_VARIABLE is specified, then no output will go to the stdout/stderr "
  69. "of the console running cmake.";
  70. }
  71. cmTypeMacro(cmExecProgramCommand, cmCommand);
  72. };
  73. #endif