/src/CMake/Source/cmTargetLinkOptionsCommand.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 "cmTargetLinkOptionsCommand.h" |
4 | | |
5 | | #include "cmList.h" |
6 | | #include "cmListFileCache.h" |
7 | | #include "cmMakefile.h" |
8 | | #include "cmMessageType.h" |
9 | | #include "cmStringAlgorithms.h" |
10 | | #include "cmTarget.h" |
11 | | #include "cmTargetPropCommandBase.h" |
12 | | |
13 | | namespace { |
14 | | |
15 | | class TargetLinkOptionsImpl : public cmTargetPropCommandBase |
16 | | { |
17 | | public: |
18 | | using cmTargetPropCommandBase::cmTargetPropCommandBase; |
19 | | |
20 | | private: |
21 | | void HandleMissingTarget(std::string const& name) override |
22 | 0 | { |
23 | 0 | this->Makefile->IssueMessage( |
24 | 0 | MessageType::FATAL_ERROR, |
25 | 0 | cmStrCat("Cannot specify link options for target \"", name, |
26 | 0 | "\" which is not built by this project.")); |
27 | 0 | } |
28 | | |
29 | | bool HandleDirectContent(cmTarget* tgt, |
30 | | std::vector<std::string> const& content, |
31 | | bool prepend, bool /*system*/) override |
32 | 0 | { |
33 | 0 | cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); |
34 | 0 | tgt->InsertLinkOption(BT<std::string>(this->Join(content), lfbt), prepend); |
35 | 0 | return true; // Successfully handled. |
36 | 0 | } |
37 | | |
38 | | std::string Join(std::vector<std::string> const& content) override |
39 | 0 | { |
40 | 0 | return cmList::to_string(content); |
41 | 0 | } |
42 | | }; |
43 | | |
44 | | } // namespace |
45 | | |
46 | | bool cmTargetLinkOptionsCommand(std::vector<std::string> const& args, |
47 | | cmExecutionStatus& status) |
48 | 0 | { |
49 | 0 | return TargetLinkOptionsImpl(status).HandleArguments( |
50 | 0 | args, "LINK_OPTIONS", TargetLinkOptionsImpl::PROCESS_BEFORE); |
51 | 0 | } |