You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
4.4 KiB

  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 cmExecuteProcessCommand_h
  14. #define cmExecuteProcessCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmExecuteProcessCommand
  17. * \brief Command that adds a target to the build system.
  18. *
  19. * cmExecuteProcessCommand is a CMake language interface to the KWSys
  20. * Process Execution implementation.
  21. */
  22. class cmExecuteProcessCommand : public cmCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmExecuteProcessCommand;
  31. }
  32. /**
  33. * This is called when the command is first encountered in
  34. * the CMakeLists.txt file.
  35. */
  36. virtual bool InitialPass(std::vector<std::string> const& args);
  37. /**
  38. * The name of the command as specified in CMakeList.txt.
  39. */
  40. virtual const char* GetName()
  41. {return "EXECUTE_PROCESS";}
  42. /**
  43. * This determines if the command is invoked when in script mode.
  44. */
  45. virtual bool IsScriptable() { return true; }
  46. /**
  47. * Succinct documentation.
  48. */
  49. virtual const char* GetTerseDocumentation()
  50. {
  51. return "Execute one or more child processes.";
  52. }
  53. /**
  54. * More documentation.
  55. */
  56. virtual const char* GetFullDocumentation()
  57. {
  58. return
  59. " EXECUTE_PROCESS(COMMAND <cmd1> [args1...]]\n"
  60. " [COMMAND <cmd2> [args2...] [...]]\n"
  61. " [WORKING_DIRECTORY <directory>]\n"
  62. " [TIMEOUT <seconds>]\n"
  63. " [RESULT_VARIABLE <variable>]\n"
  64. " [OUTPUT_VARIABLE <variable>]\n"
  65. " [ERROR_VARIABLE <variable>]\n"
  66. " [INPUT_FILE <file>]\n"
  67. " [OUTPUT_FILE <file>]\n"
  68. " [ERROR_FILE <file>]\n"
  69. " [OUTPUT_QUIET]\n"
  70. " [ERROR_QUIET]\n"
  71. " [OUTPUT_STRIP_TRAILING_WHITESPACE]\n"
  72. " [ERROR_STRIP_TRAILING_WHITESPACE])\n"
  73. "Runs the given sequence of one or more commands with the standard "
  74. "output of each process piped to the standard input of the next. "
  75. "A single standard error pipe is used for all processes. "
  76. "If WORKING_DIRECTORY is given the named directory will be set as "
  77. "the current working directory of the child processes. "
  78. "If TIMEOUT is given the child processes will be terminated if they "
  79. "do not finish in the specified number of seconds "
  80. "(fractions are allowed). "
  81. "If RESULT_VARIABLE is given the variable will be set to contain "
  82. "the result of running the processes. This will be an integer return "
  83. "code from the last child or a string describing an error condition. "
  84. "If OUTPUT_VARIABLE or ERROR_VARIABLE are given the variable named "
  85. "will be set with the contents of the standard output and standard "
  86. "error pipes respectively. If the same variable is named for both "
  87. "pipes their output will be merged in the order produced. "
  88. "If INPUT_FILE, OUTPUT_FILE, or ERROR_FILE is given the file named "
  89. "will be attached to the standard input of the first process, "
  90. "standard output of the last process, or standard error of all "
  91. "processes respectively. "
  92. "If OUTPUT_QUIET or ERROR_QUIET is given then the standard output "
  93. "or standard error results will be quietly ignored. "
  94. "If more than one OUTPUT_* or ERROR_* option is given for the same "
  95. "pipe the precedence is not specified. "
  96. "If no OUTPUT_* or ERROR_* options are given the output will be shared "
  97. "with the corresponding pipes of the CMake process itself.\n"
  98. "The EXECUTE_PROCESS command is a newer more powerful version of "
  99. "EXEC_PROGRAM, but the old command has been kept for compatibility."
  100. ;
  101. }
  102. cmTypeMacro(cmExecuteProcessCommand, cmCommand);
  103. };
  104. #endif