packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmAddCustomTargetCommand.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 cmAddCustomTargetCommand_h
13 #define cmAddCustomTargetCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmAddCustomTargetCommand
18  * \brief Command that adds a target to the build system.
19  *
20  * cmAddCustomTargetCommand 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 cmAddCustomTargetCommand : public cmCommand
25 {
26 public:
27   /**
28    * This is a virtual constructor for the command.
29    */
30   virtual cmCommand* Clone()
31     {
32     return new cmAddCustomTargetCommand;
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 "add_custom_target";}
47
48   /**
49    * Succinct documentation.
50    */
51   virtual const char* GetTerseDocumentation() const
52     {
53     return "Add a target with no output so it will always be built.";
54     }
55
56   /**
57    * More documentation.
58    */
59   virtual const char* GetFullDocumentation() const
60     {
61     return
62       "  add_custom_target(Name [ALL] [command1 [args1...]]\n"
63       "                    [COMMAND command2 [args2...] ...]\n"
64       "                    [DEPENDS depend depend depend ... ]\n"
65       "                    [WORKING_DIRECTORY dir]\n"
66       "                    [COMMENT comment] [VERBATIM]\n"
67       "                    [SOURCES src1 [src2...]])\n"
68       "Adds a target with the given name that executes the given commands. "
69       "The target has no output file and is ALWAYS CONSIDERED OUT OF DATE "
70       "even if the commands try to create a file with the name of the "
71       "target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies. "
72       "By default nothing depends on the custom target. Use "
73       "ADD_DEPENDENCIES to add dependencies to or from other targets. "
74       "If the ALL option is specified "
75       "it indicates that this target should be added to the default build "
76       "target so that it will be run every time "
77       "(the command cannot be called ALL). "
78       "The command and arguments are optional and if not specified an "
79       "empty target will be created. "
80       "If WORKING_DIRECTORY is set, then the command will be run in that "
81       "directory. "
82       "If it is a relative path it will be interpreted relative to the "
83       "build tree directory corresponding to the current source directory. "
84       "If COMMENT is set, the value will be displayed as a "
85       "message before the commands are executed at build time. "
86       "Dependencies listed with the DEPENDS argument may reference files "
87       "and outputs of custom commands created with add_custom_command() in "
88       "the same directory (CMakeLists.txt file).\n"
89       "If VERBATIM is given then all arguments to the commands will be "
90       "escaped properly for the build tool so that the invoked command "
91       "receives each argument unchanged.  "
92       "Note that one level of escapes is still used by the CMake language "
93       "processor before add_custom_target even sees the arguments. "
94       "Use of VERBATIM is recommended as it enables correct behavior. "
95       "When VERBATIM is not given the behavior is platform specific because "
96       "there is no protection of tool-specific special characters."
97       "\n"
98       "The SOURCES option specifies additional source files to be included "
99       "in the custom target.  "
100       "Specified source files will be added to IDE project files for "
101       "convenience in editing even if they have not build rules."
102       ;
103     }
104
105   cmTypeMacro(cmAddCustomTargetCommand, cmCommand);
106 };
107
108 #endif