1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmExecuteProcessCommand.h,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.6 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmExecuteProcessCommand_h
18 #define cmExecuteProcessCommand_h
20 #include "cmCommand.h"
22 /** \class cmExecuteProcessCommand
23 * \brief Command that adds a target to the build system.
25 * cmExecuteProcessCommand is a CMake language interface to the KWSys
26 * Process Execution implementation.
28 class cmExecuteProcessCommand
: public cmCommand
32 * This is a virtual constructor for the command.
34 virtual cmCommand
* Clone()
36 return new cmExecuteProcessCommand
;
40 * This is called when the command is first encountered in
41 * the CMakeLists.txt file.
43 virtual bool InitialPass(std::vector
<std::string
> const& args
,
44 cmExecutionStatus
&status
);
47 * The name of the command as specified in CMakeList.txt.
49 virtual const char* GetName()
50 {return "execute_process";}
53 * This determines if the command is invoked when in script mode.
55 virtual bool IsScriptable() { return true; }
58 * Succinct documentation.
60 virtual const char* GetTerseDocumentation()
62 return "Execute one or more child processes.";
68 virtual const char* GetFullDocumentation()
71 " execute_process(COMMAND <cmd1> [args1...]]\n"
72 " [COMMAND <cmd2> [args2...] [...]]\n"
73 " [WORKING_DIRECTORY <directory>]\n"
74 " [TIMEOUT <seconds>]\n"
75 " [RESULT_VARIABLE <variable>]\n"
76 " [OUTPUT_VARIABLE <variable>]\n"
77 " [ERROR_VARIABLE <variable>]\n"
78 " [INPUT_FILE <file>]\n"
79 " [OUTPUT_FILE <file>]\n"
80 " [ERROR_FILE <file>]\n"
83 " [OUTPUT_STRIP_TRAILING_WHITESPACE]\n"
84 " [ERROR_STRIP_TRAILING_WHITESPACE])\n"
85 "Runs the given sequence of one or more commands with the standard "
86 "output of each process piped to the standard input of the next. "
87 "A single standard error pipe is used for all processes. "
88 "If WORKING_DIRECTORY is given the named directory will be set as "
89 "the current working directory of the child processes. "
90 "If TIMEOUT is given the child processes will be terminated if they "
91 "do not finish in the specified number of seconds "
92 "(fractions are allowed). "
93 "If RESULT_VARIABLE is given the variable will be set to contain "
94 "the result of running the processes. This will be an integer return "
95 "code from the last child or a string describing an error condition. "
96 "If OUTPUT_VARIABLE or ERROR_VARIABLE are given the variable named "
97 "will be set with the contents of the standard output and standard "
98 "error pipes respectively. If the same variable is named for both "
99 "pipes their output will be merged in the order produced. "
100 "If INPUT_FILE, OUTPUT_FILE, or ERROR_FILE is given the file named "
101 "will be attached to the standard input of the first process, "
102 "standard output of the last process, or standard error of all "
103 "processes respectively. "
104 "If OUTPUT_QUIET or ERROR_QUIET is given then the standard output "
105 "or standard error results will be quietly ignored. "
106 "If more than one OUTPUT_* or ERROR_* option is given for the same "
107 "pipe the precedence is not specified. "
108 "If no OUTPUT_* or ERROR_* options are given the output will be shared "
109 "with the corresponding pipes of the CMake process itself.\n"
110 "The execute_process command is a newer more powerful version of "
111 "exec_program, but the old command has been kept for compatibility."
115 cmTypeMacro(cmExecuteProcessCommand
, cmCommand
);