1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddCustomTargetCommand.h,v $
6 Date: $Date: 2009-04-01 14:31:41 $
7 Version: $Revision: 1.25 $
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 cmAddCustomTargetCommand_h
18 #define cmAddCustomTargetCommand_h
20 #include "cmCommand.h"
22 /** \class cmAddCustomTargetCommand
23 * \brief Command that adds a target to the build system.
25 * cmAddCustomTargetCommand 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 cmAddCustomTargetCommand
: public cmCommand
33 * This is a virtual constructor for the command.
35 virtual cmCommand
* Clone()
37 return new cmAddCustomTargetCommand
;
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 "add_custom_target";}
54 * Succinct documentation.
56 virtual const char* GetTerseDocumentation()
58 return "Add a target with no output so it will always be built.";
64 virtual const char* GetFullDocumentation()
67 " add_custom_target(Name [ALL] [command1 [args1...]]\n"
68 " [COMMAND command2 [args2...] ...]\n"
69 " [DEPENDS depend depend depend ... ]\n"
70 " [WORKING_DIRECTORY dir]\n"
71 " [COMMENT comment] [VERBATIM]\n"
72 " [SOURCES src1 [src2...]])\n"
73 "Adds a target with the given name that executes the given commands. "
74 "The target has no output file and is ALWAYS CONSIDERED OUT OF DATE "
75 "even if the commands try to create a file with the name of the "
76 "target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies. "
77 "By default nothing depends on the custom target. Use "
78 "ADD_DEPENDENCIES to add dependencies to or from other targets. "
79 "If the ALL option is specified "
80 "it indicates that this target should be added to the default build "
81 "target so that it will be run every time "
82 "(the command cannot be called ALL). "
83 "The command and arguments are optional and if not specified an "
84 "empty target will be created. "
85 "If WORKING_DIRECTORY is set, then the command will be run in that "
87 "If COMMENT is set, the value will be displayed as a "
88 "message before the commands are executed at build time. "
89 "Dependencies listed with the DEPENDS argument may reference files "
90 "and outputs of custom commands created with add_custom_command() in "
91 "the same directory (CMakeLists.txt file).\n"
92 "If VERBATIM is given then all arguments to the commands will be "
93 "escaped properly for the build tool so that the invoked command "
94 "receives each argument unchanged. "
95 "Note that one level of escapes is still used by the CMake language "
96 "processor before add_custom_target even sees the arguments. "
97 "Use of VERBATIM is recommended as it enables correct behavior. "
98 "When VERBATIM is not given the behavior is platform specific because "
99 "there is no protection of tool-specific special characters."
101 "The SOURCES option specifies additional source files to be included "
102 "in the custom target. "
103 "Specified source files will be added to IDE project files for "
104 "convenience in editing even if they have not build rules."
108 cmTypeMacro(cmAddCustomTargetCommand
, cmCommand
);