1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmExecProgramCommand.h,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.23 $
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 cmExecProgramCommand_h
18 #define cmExecProgramCommand_h
20 #include "cmCommand.h"
22 /** \class cmExecProgramCommand
23 * \brief Command that adds a target to the build system.
25 * cmExecProgramCommand adds an extra target to the build system.
26 * This is useful when you would like to add special
27 * targets like "install,", "clean," and so on.
29 class cmExecProgramCommand
: public cmCommand
33 * This is a virtual constructor for the command.
35 virtual cmCommand
* Clone()
37 return new cmExecProgramCommand
;
41 * This is called when the command is first encountered in
42 * the CMakeLists.txt file.
44 virtual bool InitialPass(std::vector
<std::string
> const& args
,
45 cmExecutionStatus
&status
);
48 * The name of the command as specified in CMakeList.txt.
50 virtual const char* GetName()
51 {return "exec_program";}
54 * This determines if the command is invoked when in script mode.
56 virtual bool IsScriptable() { return true; }
59 * Succinct documentation.
61 virtual const char* GetTerseDocumentation()
64 "Deprecated. Use the execute_process() command instead.";
70 virtual const char* GetFullDocumentation()
73 "Run an executable program during the processing of the CMakeList.txt"
75 " exec_program(Executable [directory in which to run]\n"
76 " [ARGS <arguments to executable>]\n"
77 " [OUTPUT_VARIABLE <var>]\n"
78 " [RETURN_VALUE <var>])\n"
79 "The executable is run in the optionally specified directory. The "
80 "executable can include arguments if it is double quoted, but it is "
81 "better to use the optional ARGS argument to specify arguments to the "
82 "program. This is because cmake will then be able to escape spaces "
83 "in the executable path. An optional argument OUTPUT_VARIABLE "
84 "specifies a variable in which to store the output. "
85 "To capture the return value of the execution, provide a RETURN_VALUE. "
86 "If OUTPUT_VARIABLE is specified, then no output will go to the "
87 "stdout/stderr of the console running cmake.\n"
91 /** This command is kept for compatibility with older CMake versions. */
92 virtual bool IsDiscouraged()
97 cmTypeMacro(cmExecProgramCommand
, cmCommand
);