/src/CMake/Source/cmLinkLibrariesCommand.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #include "cmLinkLibrariesCommand.h" |
4 | | |
5 | | #include "cmExecutionStatus.h" |
6 | | #include "cmMakefile.h" |
7 | | |
8 | | bool cmLinkLibrariesCommand(std::vector<std::string> const& args, |
9 | | cmExecutionStatus& status) |
10 | 0 | { |
11 | 0 | if (args.empty()) { |
12 | 0 | return true; |
13 | 0 | } |
14 | 0 | cmMakefile& mf = status.GetMakefile(); |
15 | | // add libraries, note that there is an optional prefix |
16 | | // of debug and optimized than can be used |
17 | 0 | for (auto i = args.begin(); i != args.end(); ++i) { |
18 | 0 | if (*i == "debug") { |
19 | 0 | ++i; |
20 | 0 | if (i == args.end()) { |
21 | 0 | status.SetError("The \"debug\" argument must be followed by " |
22 | 0 | "a library"); |
23 | 0 | return false; |
24 | 0 | } |
25 | 0 | mf.AppendProperty("LINK_LIBRARIES", "debug"); |
26 | 0 | } else if (*i == "optimized") { |
27 | 0 | ++i; |
28 | 0 | if (i == args.end()) { |
29 | 0 | status.SetError("The \"optimized\" argument must be followed by " |
30 | 0 | "a library"); |
31 | 0 | return false; |
32 | 0 | } |
33 | 0 | mf.AppendProperty("LINK_LIBRARIES", "optimized"); |
34 | 0 | } |
35 | 0 | mf.AppendProperty("LINK_LIBRARIES", *i); |
36 | 0 | } |
37 | | |
38 | 0 | return true; |
39 | 0 | } |