TZIVI-254: IVI needs a newer version of cmake
[profile/ivi/cmake.git] / Source / cmExecProgramCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
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
14
15 #include "cmCommand.h"
16
17 /** \class cmExecProgramCommand
18  * \brief Command that adds a target to the build system.
19  *
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.
23  */
24 class cmExecProgramCommand : public cmCommand
25 {
26 public:
27   /**
28    * This is a virtual constructor for the command.
29    */
30   virtual cmCommand* Clone() 
31     {
32     return new cmExecProgramCommand;
33     }
34
35   /**
36    * This is called when the command is first encountered in
37    * the CMakeLists.txt file.
38    */
39   virtual bool InitialPass(std::vector<std::string> const& args,
40                            cmExecutionStatus &status);
41   
42   /**
43    * The name of the command as specified in CMakeList.txt.
44    */
45   virtual const char* GetName() const
46     {return "exec_program";}
47   
48   /**
49    * This determines if the command is invoked when in script mode.
50    */
51   virtual bool IsScriptable() const { return true; }
52
53   /**
54    * Succinct documentation.
55    */
56   virtual const char* GetTerseDocumentation() const
57     {
58     return 
59       "Deprecated.  Use the execute_process() command instead.";
60     }
61   
62   /**
63    * More documentation.
64    */
65   virtual const char* GetFullDocumentation() const
66     {
67     return
68       "Run an executable program during the processing of the CMakeList.txt"
69       " file.\n"
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"
83       ;
84     }
85   
86   /** This command is kept for compatibility with older CMake versions. */
87   virtual bool IsDiscouraged() const
88     {
89     return true;
90     }
91
92   cmTypeMacro(cmExecProgramCommand, cmCommand);
93 };
94
95 #endif