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 cmExecutablesCommand_h
13 #define cmExecutablesCommand_h
15 #include "cmCommand.h"
17 /** \class cmExecutablesCommand
18 * \brief Defines a list of executables to build.
20 * cmExecutablesCommand defines a list of executable (i.e., test)
23 class cmAddExecutableCommand : public cmCommand
27 * This is a virtual constructor for the command.
29 virtual cmCommand* Clone()
31 return new cmAddExecutableCommand;
35 * This is called when the command is first encountered in
36 * the CMakeLists.txt file.
38 virtual bool InitialPass(std::vector<std::string> const& args,
39 cmExecutionStatus &status);
42 * The name of the command as specified in CMakeList.txt.
44 virtual const char* GetName() const { return "add_executable";}
47 * Succinct documentation.
49 virtual const char* GetTerseDocumentation() const
52 "Add an executable to the project using the specified source files.";
58 virtual const char* GetFullDocumentation() const
61 " add_executable(<name> [WIN32] [MACOSX_BUNDLE]\n"
62 " [EXCLUDE_FROM_ALL]\n"
63 " source1 source2 ... sourceN)\n"
64 "Adds an executable target called <name> to be built from the "
65 "source files listed in the command invocation. "
66 "The <name> corresponds to the logical target name and must be "
67 "globally unique within a project. "
68 "The actual file name of the executable built is constructed based on "
69 "conventions of the native platform "
70 "(such as <name>.exe or just <name>). "
72 "By default the executable file will be created in the build tree "
73 "directory corresponding to the source tree directory in which "
74 "the command was invoked. "
75 "See documentation of the RUNTIME_OUTPUT_DIRECTORY "
76 "target property to change this location. "
77 "See documentation of the OUTPUT_NAME target property to change "
78 "the <name> part of the final file name. "
80 "If WIN32 is given the property WIN32_EXECUTABLE will be set on the "
82 "See documentation of that target property for details."
84 "If MACOSX_BUNDLE is given the corresponding property will be "
85 "set on the created target. "
86 "See documentation of the MACOSX_BUNDLE target property for details."
88 "If EXCLUDE_FROM_ALL is given the corresponding property will be "
89 "set on the created target. "
90 "See documentation of the EXCLUDE_FROM_ALL target property for "
93 "The add_executable command can also create IMPORTED executable "
94 "targets using this signature:\n"
95 " add_executable(<name> IMPORTED [GLOBAL])\n"
96 "An IMPORTED executable target references an executable file located "
97 "outside the project. "
98 "No rules are generated to build it. "
99 "The target name has scope in the directory in which it is created "
100 "and below, but the GLOBAL option extends visibility. "
101 "It may be referenced like any target built within the project. "
102 "IMPORTED executables are useful for convenient reference from "
103 "commands like add_custom_command. "
104 "Details about the imported executable are specified by setting "
105 "properties whose names begin in \"IMPORTED_\". "
106 "The most important such property is IMPORTED_LOCATION "
107 "(and its per-configuration version IMPORTED_LOCATION_<CONFIG>) "
108 "which specifies the location of the main executable file on disk. "
109 "See documentation of the IMPORTED_* properties for more information."
112 " add_executable(<name> ALIAS <target>)\n"
113 "creates an alias, such that <name> can be used to refer to <target> "
114 "in subsequent commands. The <name> does not appear in the generated "
115 "buildsystem as a make target. The <target> may not be an IMPORTED "
116 "target or an ALIAS. Alias targets can be used as linkable targets, "
117 "targets to read properties from, executables for custom commands and "
118 "custom targets. They can also be tested for existance with the "
119 "regular if(TARGET) subcommand. The <name> may not be used to modify "
120 "properties of <target>, that is, it may not be used as the operand of "
121 "set_property, set_target_properties, target_link_libraries etc. An "
122 "ALIAS target may not be installed of exported."
126 cmTypeMacro(cmAddExecutableCommand, cmCommand);