1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddLibraryCommand.h,v $
6 <<<<<<< cmAddLibraryCommand.h
7 Date: $Date: 2008/02/11 18:35:39 $
8 Version: $Revision: 1.22 $
10 Date: $Date: 2008-08-18 15:39:22 $
11 Version: $Revision: 1.23 $
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmLibrarysCommand_h
23 #define cmLibrarysCommand_h
25 #include "cmCommand.h"
27 /** \class cmLibrarysCommand
28 * \brief Defines a list of executables to build.
30 * cmLibrarysCommand defines a list of executable (i.e., test)
33 class cmAddLibraryCommand
: public cmCommand
37 * This is a virtual constructor for the command.
39 virtual cmCommand
* Clone()
41 return new cmAddLibraryCommand
;
45 * This is called when the command is first encountered in
46 * the CMakeLists.txt file.
48 virtual bool InitialPass(std::vector
<std::string
> const& args
,
49 cmExecutionStatus
&status
);
52 * The name of the command as specified in CMakeList.txt.
54 virtual const char* GetName() { return "add_library";}
57 * Succinct documentation.
59 virtual const char* GetTerseDocumentation()
61 return "Add a library to the project using the specified source files.";
67 virtual const char* GetFullDocumentation()
70 " add_library(<name> [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL]\n"
71 " source1 source2 ... sourceN)\n"
72 "Adds a library target called <name> to be built from the "
73 "source files listed in the command invocation. "
74 "The <name> corresponds to the logical target name and must be "
75 "globally unique within a project. "
76 "The actual file name of the library built is constructed based on "
77 "conventions of the native platform "
78 "(such as lib<name>.a or <name>.lib)."
80 "STATIC, SHARED, or MODULE may be given to specify the type of library "
82 "STATIC libraries are archives of object files for use when linking "
84 "SHARED libraries are linked dynamically and loaded at runtime. "
85 "MODULE libraries are plugins that are not linked into other targets "
86 "but may be loaded dynamically at runtime using dlopen-like "
88 "If no type is given explicitly the type is STATIC or SHARED based "
89 "on whether the current value of the variable BUILD_SHARED_LIBS is "
92 "By default the library file will be created in the build tree "
93 "directory corresponding to the source tree directory in which "
94 "the command was invoked. "
95 "See documentation of the ARCHIVE_OUTPUT_DIRECTORY, "
96 "LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY "
97 "target properties to change this location. "
98 "See documentation of the OUTPUT_NAME target property to change "
99 "the <name> part of the final file name. "
101 "If EXCLUDE_FROM_ALL is given the corresponding property will be "
102 "set on the created target. "
103 "See documentation of the EXCLUDE_FROM_ALL target property for "
106 "The add_library command can also create IMPORTED library "
107 "targets using this signature:\n"
108 " add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED)\n"
109 "An IMPORTED library target references a library file located "
110 "outside the project. "
111 "No rules are generated to build it. "
112 "The target name has scope in the directory in which it is created "
114 "It may be referenced like any target built within the project. "
115 "IMPORTED libraries are useful for convenient reference from "
116 "commands like target_link_libraries. "
117 "Details about the imported library are specified by setting "
118 "properties whose names begin in \"IMPORTED_\". "
119 "The most important such property is IMPORTED_LOCATION "
120 "(and its per-configuration version IMPORTED_LOCATION_<CONFIG>) "
121 "which specifies the location of the main library file on disk. "
122 "See documentation of the IMPORTED_* properties for more information."
126 cmTypeMacro(cmAddLibraryCommand
, cmCommand
);