STYLE: Nightly Date Stamp
[cmake.git] / Source / cmTargetLinkLibrariesCommand.h
blob58bea81ca499db13b70dde6fa7088d4c389c7430
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmTargetLinkLibrariesCommand.h,v $
5 Language: C++
6 Date: $Date: 2008-09-04 21:34:24 $
7 Version: $Revision: 1.19 $
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 cmTargetLinkLibrariesCommand_h
18 #define cmTargetLinkLibrariesCommand_h
20 #include "cmCommand.h"
22 /** \class cmTargetLinkLibrariesCommand
23 * \brief Specify a list of libraries to link into executables.
25 * cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
26 * into executable(s) or shared objects. The names of the libraries
27 * should be those defined by the LIBRARY(library) command(s).
29 class cmTargetLinkLibrariesCommand : public cmCommand
31 public:
32 /**
33 * This is a virtual constructor for the command.
35 virtual cmCommand* Clone()
37 return new cmTargetLinkLibrariesCommand;
40 /**
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);
47 /**
48 * The name of the command as specified in CMakeList.txt.
50 virtual const char* GetName() { return "target_link_libraries";}
52 /**
53 * Succinct documentation.
55 virtual const char* GetTerseDocumentation()
57 return
58 "Link a target to given libraries.";
61 /**
62 * More documentation.
64 virtual const char* GetFullDocumentation()
66 return
67 " target_link_libraries(<target> [lib1 [lib2 [...]]]\n"
68 " [[debug|optimized|general] <lib>] ...)\n"
69 "Specify a list of libraries to be linked into the specified target. "
70 "If any library name matches that of a target in the current project "
71 "a dependency will automatically be added in the build system to make "
72 "sure the library being linked is up-to-date before the target links."
73 "\n"
74 "A \"debug\", \"optimized\", or \"general\" keyword indicates that "
75 "the library immediately following it is to be used only for the "
76 "corresponding build configuration. "
77 "The \"debug\" keyword corresponds to the Debug configuration "
78 "(or to configurations named in the DEBUG_CONFIGURATIONS global "
79 "property if it is set). "
80 "The \"optimized\" keyword corresponds to all other configurations. "
81 "The \"general\" keyword corresponds to all configurations, and is "
82 "purely optional (assumed if omitted). "
83 "Higher granularity may be achieved for per-configuration rules "
84 "by creating and linking to IMPORTED library targets. "
85 "See the IMPORTED mode of the add_library command for more "
86 "information. "
87 "\n"
88 "Library dependencies are transitive by default. "
89 "When this target is linked into another target then the libraries "
90 "linked to this target will appear on the link line for the other "
91 "target too. "
92 "See the LINK_INTERFACE_LIBRARIES target property to override the "
93 "set of transitive link dependencies for a target."
94 "\n"
95 " target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n"
96 " [[debug|optimized|general] <lib>] ...)\n"
97 "The LINK_INTERFACE_LIBRARIES mode appends the libraries "
98 "to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent "
99 "target properties instead of using them for linking. "
100 "Libraries specified as \"debug\" are appended to the "
101 "the LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties "
102 "corresponding to configurations listed in the DEBUG_CONFIGURATIONS "
103 "global property if it is set). "
104 "Libraries specified as \"optimized\" are appended to the "
105 "the LINK_INTERFACE_LIBRARIES property. "
106 "Libraries specified as \"general\" (or without any keyword) are "
107 "treated as if specified for both \"debug\" and \"optimized\"."
111 cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
112 private:
113 void LinkLibraryTypeSpecifierWarning(int left, int right);
114 static const char* LinkLibraryTypeNames[3];
116 cmTarget* Target;
117 bool DoingInterface;
119 void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
124 #endif