2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2006-02-04 00:51:46 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2006-02-04 00:51:46 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2006-02-04 00:51:46 +03:00
|
|
|
#ifndef cmExecuteProcessCommand_h
|
|
|
|
#define cmExecuteProcessCommand_h
|
|
|
|
|
|
|
|
#include "cmCommand.h"
|
|
|
|
|
|
|
|
/** \class cmExecuteProcessCommand
|
|
|
|
* \brief Command that adds a target to the build system.
|
|
|
|
*
|
|
|
|
* cmExecuteProcessCommand is a CMake language interface to the KWSys
|
|
|
|
* Process Execution implementation.
|
|
|
|
*/
|
|
|
|
class cmExecuteProcessCommand : public cmCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This is a virtual constructor for the command.
|
|
|
|
*/
|
|
|
|
virtual cmCommand* Clone()
|
|
|
|
{
|
|
|
|
return new cmExecuteProcessCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is called when the command is first encountered in
|
|
|
|
* the CMakeLists.txt file.
|
|
|
|
*/
|
2008-01-23 18:28:26 +03:00
|
|
|
virtual bool InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus &status);
|
2006-02-04 00:51:46 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the command as specified in CMakeList.txt.
|
|
|
|
*/
|
2012-02-25 10:49:24 +04:00
|
|
|
virtual const char* GetName() const
|
2007-10-10 19:47:43 +04:00
|
|
|
{return "execute_process";}
|
2006-02-04 00:51:46 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This determines if the command is invoked when in script mode.
|
|
|
|
*/
|
2012-02-25 10:49:24 +04:00
|
|
|
virtual bool IsScriptable() const { return true; }
|
2006-02-04 00:51:46 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Succinct documentation.
|
|
|
|
*/
|
2012-02-25 10:49:24 +04:00
|
|
|
virtual const char* GetTerseDocumentation() const
|
2006-02-04 00:51:46 +03:00
|
|
|
{
|
|
|
|
return "Execute one or more child processes.";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* More documentation.
|
|
|
|
*/
|
2012-02-25 10:49:24 +04:00
|
|
|
virtual const char* GetFullDocumentation() const
|
2006-02-04 00:51:46 +03:00
|
|
|
{
|
|
|
|
return
|
2007-10-10 19:47:43 +04:00
|
|
|
" execute_process(COMMAND <cmd1> [args1...]]\n"
|
2006-02-04 00:51:46 +03:00
|
|
|
" [COMMAND <cmd2> [args2...] [...]]\n"
|
|
|
|
" [WORKING_DIRECTORY <directory>]\n"
|
|
|
|
" [TIMEOUT <seconds>]\n"
|
|
|
|
" [RESULT_VARIABLE <variable>]\n"
|
|
|
|
" [OUTPUT_VARIABLE <variable>]\n"
|
|
|
|
" [ERROR_VARIABLE <variable>]\n"
|
|
|
|
" [INPUT_FILE <file>]\n"
|
|
|
|
" [OUTPUT_FILE <file>]\n"
|
|
|
|
" [ERROR_FILE <file>]\n"
|
|
|
|
" [OUTPUT_QUIET]\n"
|
2006-10-16 19:32:28 +04:00
|
|
|
" [ERROR_QUIET]\n"
|
|
|
|
" [OUTPUT_STRIP_TRAILING_WHITESPACE]\n"
|
|
|
|
" [ERROR_STRIP_TRAILING_WHITESPACE])\n"
|
2006-02-04 00:51:46 +03:00
|
|
|
"Runs the given sequence of one or more commands with the standard "
|
|
|
|
"output of each process piped to the standard input of the next. "
|
|
|
|
"A single standard error pipe is used for all processes. "
|
|
|
|
"If WORKING_DIRECTORY is given the named directory will be set as "
|
|
|
|
"the current working directory of the child processes. "
|
|
|
|
"If TIMEOUT is given the child processes will be terminated if they "
|
|
|
|
"do not finish in the specified number of seconds "
|
|
|
|
"(fractions are allowed). "
|
|
|
|
"If RESULT_VARIABLE is given the variable will be set to contain "
|
|
|
|
"the result of running the processes. This will be an integer return "
|
|
|
|
"code from the last child or a string describing an error condition. "
|
|
|
|
"If OUTPUT_VARIABLE or ERROR_VARIABLE are given the variable named "
|
2006-05-10 23:08:38 +04:00
|
|
|
"will be set with the contents of the standard output and standard "
|
|
|
|
"error pipes respectively. If the same variable is named for both "
|
|
|
|
"pipes their output will be merged in the order produced. "
|
2006-02-04 00:51:46 +03:00
|
|
|
"If INPUT_FILE, OUTPUT_FILE, or ERROR_FILE is given the file named "
|
|
|
|
"will be attached to the standard input of the first process, "
|
|
|
|
"standard output of the last process, or standard error of all "
|
|
|
|
"processes respectively. "
|
|
|
|
"If OUTPUT_QUIET or ERROR_QUIET is given then the standard output "
|
|
|
|
"or standard error results will be quietly ignored. "
|
|
|
|
"If more than one OUTPUT_* or ERROR_* option is given for the same "
|
|
|
|
"pipe the precedence is not specified. "
|
|
|
|
"If no OUTPUT_* or ERROR_* options are given the output will be shared "
|
2006-02-10 19:43:35 +03:00
|
|
|
"with the corresponding pipes of the CMake process itself.\n"
|
2007-10-10 19:47:43 +04:00
|
|
|
"The execute_process command is a newer more powerful version of "
|
|
|
|
"exec_program, but the old command has been kept for compatibility."
|
2006-02-04 00:51:46 +03:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmTypeMacro(cmExecuteProcessCommand, cmCommand);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|