1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmAddLibraryCommand.h,v $
6 Date: $Date: 2008/02/11 18:35:39 $
7 Version: $Revision: 1.22 $
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] [EXCLUDE_FROM_ALL]\n"
66 " source1 source2 ... sourceN)\n"
67 "Adds a library target called <name> to be built from the "
68 "source files listed in the command invocation. "
69 "The <name> corresponds to the logical target name and must be "
70 "globally unique within a project. "
71 "The actual file name of the library built is constructed based on "
72 "conventions of the native platform "
73 "(such as lib<name>.a or <name>.lib)."
75 "STATIC, SHARED, or MODULE may be given to specify the type of library "
77 "STATIC libraries are archives of object files for use when linking "
79 "SHARED libraries are linked dynamically and loaded at runtime. "
80 "MODULE libraries are plugins that are not linked into other targets "
81 "but may be loaded dynamically at runtime using dlopen-like "
83 "If no type is given explicitly the type is STATIC or SHARED based "
84 "on whether the current value of the variable BUILD_SHARED_LIBS is "
87 "By default the library file will be created in the build tree "
88 "directory corresponding to the source tree directory in which "
89 "the command was invoked. "
90 "See documentation of the ARCHIVE_OUTPUT_DIRECTORY, "
91 "LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY "
92 "target properties to change this location. "
93 "See documentation of the OUTPUT_NAME target property to change "
94 "the <name> part of the final file name. "
96 "If EXCLUDE_FROM_ALL is given the corresponding property will be "
97 "set on the created target. "
98 "See documentation of the EXCLUDE_FROM_ALL target property for "
101 "The add_library command can also create IMPORTED library "
102 "targets using this signature:\n"
103 " add_library(<name> <SHARED|STATIC|MODULE> IMPORTED)\n"
104 "An IMPORTED library target references a library file located "
105 "outside the project. "
106 "No rules are generated to build it. "
107 "The target name has scope in the directory in which it is created "
109 "It may be referenced like any target built within the project. "
110 "IMPORTED libraries are useful for convenient reference from "
111 "commands like target_link_libraries. "
112 "Details about the imported library are specified by setting "
113 "properties whose names begin in \"IMPORTED_\". "
114 "The most important such property is IMPORTED_LOCATION "
115 "(and its per-configuration version IMPORTED_LOCATION_<CONFIG>) "
116 "which specifies the location of the main library file on disk. "
117 "See documentation of the IMPORTED_* properties for more information."
121 cmTypeMacro(cmAddLibraryCommand
, cmCommand
);