1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddLibraryCommand.h,v $
6 Date: $Date: 2009-09-03 19:29:29 $
7 Version: $Revision: 1.24 $
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 cmLibrarysCommand_h
18 #define cmLibrarysCommand_h
20 #include "cmCommand.h"
22 /** \class cmLibrarysCommand
23 * \brief Defines a list of executables to build.
25 * cmLibrarysCommand defines a list of executable (i.e., test)
28 class cmAddLibraryCommand
: public cmCommand
32 * This is a virtual constructor for the command.
34 virtual cmCommand
* Clone()
36 return new cmAddLibraryCommand
;
40 * This is called when the command is first encountered in
41 * the CMakeLists.txt file.
43 virtual bool InitialPass(std::vector
<std::string
> const& args
,
44 cmExecutionStatus
&status
);
47 * The name of the command as specified in CMakeList.txt.
49 virtual const char* GetName() { return "add_library";}
52 * Succinct documentation.
54 virtual const char* GetTerseDocumentation()
56 return "Add a library to the project using the specified source files.";
62 virtual const char* GetFullDocumentation()
65 " add_library(<name> [STATIC | SHARED | MODULE]\n"
66 " [EXCLUDE_FROM_ALL]\n"
67 " source1 source2 ... sourceN)\n"
68 "Adds a library target called <name> to be built from the "
69 "source files listed in the command invocation. "
70 "The <name> corresponds to the logical target name and must be "
71 "globally unique within a project. "
72 "The actual file name of the library built is constructed based on "
73 "conventions of the native platform "
74 "(such as lib<name>.a or <name>.lib)."
76 "STATIC, SHARED, or MODULE may be given to specify the type of library "
78 "STATIC libraries are archives of object files for use when linking "
80 "SHARED libraries are linked dynamically and loaded at runtime. "
81 "MODULE libraries are plugins that are not linked into other targets "
82 "but may be loaded dynamically at runtime using dlopen-like "
84 "If no type is given explicitly the type is STATIC or SHARED based "
85 "on whether the current value of the variable BUILD_SHARED_LIBS is "
88 "By default the library file will be created in the build tree "
89 "directory corresponding to the source tree directory in which "
90 "the command was invoked. "
91 "See documentation of the ARCHIVE_OUTPUT_DIRECTORY, "
92 "LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY "
93 "target properties to change this location. "
94 "See documentation of the OUTPUT_NAME target property to change "
95 "the <name> part of the final file name. "
97 "If EXCLUDE_FROM_ALL is given the corresponding property will be "
98 "set on the created target. "
99 "See documentation of the EXCLUDE_FROM_ALL target property for "
102 "The add_library command can also create IMPORTED library "
103 "targets using this signature:\n"
104 " add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED)\n"
105 "An IMPORTED library target references a library file located "
106 "outside the project. "
107 "No rules are generated to build it. "
108 "The target name has scope in the directory in which it is created "
110 "It may be referenced like any target built within the project. "
111 "IMPORTED libraries are useful for convenient reference from "
112 "commands like target_link_libraries. "
113 "Details about the imported library are specified by setting "
114 "properties whose names begin in \"IMPORTED_\". "
115 "The most important such property is IMPORTED_LOCATION "
116 "(and its per-configuration version IMPORTED_LOCATION_<CONFIG>) "
117 "which specifies the location of the main library file on disk. "
118 "See documentation of the IMPORTED_* properties for more information."
122 cmTypeMacro(cmAddLibraryCommand
, cmCommand
);