1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #ifndef cmExecProgramCommand_h
13 #define cmExecProgramCommand_h
15 #include "cmCommand.h"
17 /** \class cmExecProgramCommand
18 * \brief Command that adds a target to the build system.
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.
24 class cmExecProgramCommand : public cmCommand
28 * This is a virtual constructor for the command.
30 virtual cmCommand* Clone()
32 return new cmExecProgramCommand;
36 * This is called when the command is first encountered in
37 * the CMakeLists.txt file.
39 virtual bool InitialPass(std::vector<std::string> const& args,
40 cmExecutionStatus &status);
43 * The name of the command as specified in CMakeList.txt.
45 virtual const char* GetName() const
46 {return "exec_program";}
49 * This determines if the command is invoked when in script mode.
51 virtual bool IsScriptable() const { return true; }
54 * Succinct documentation.
56 virtual const char* GetTerseDocumentation() const
59 "Deprecated. Use the execute_process() command instead.";
65 virtual const char* GetFullDocumentation() const
68 "Run an executable program during the processing of the CMakeList.txt"
70 " exec_program(Executable [directory in which to run]\n"
71 " [ARGS <arguments to executable>]\n"
72 " [OUTPUT_VARIABLE <var>]\n"
73 " [RETURN_VALUE <var>])\n"
74 "The executable is run in the optionally specified directory. The "
75 "executable can include arguments if it is double quoted, but it is "
76 "better to use the optional ARGS argument to specify arguments to the "
77 "program. This is because cmake will then be able to escape spaces "
78 "in the executable path. An optional argument OUTPUT_VARIABLE "
79 "specifies a variable in which to store the output. "
80 "To capture the return value of the execution, provide a RETURN_VALUE. "
81 "If OUTPUT_VARIABLE is specified, then no output will go to the "
82 "stdout/stderr of the console running cmake.\n"
86 /** This command is kept for compatibility with older CMake versions. */
87 virtual bool IsDiscouraged() const
92 cmTypeMacro(cmExecProgramCommand, cmCommand);