diff options
Diffstat (limited to 'Source/cmTargetLinkOptionsCommand.cxx')
-rw-r--r-- | Source/cmTargetLinkOptionsCommand.cxx | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx index dbd7bfe..df9416f 100644 --- a/Source/cmTargetLinkOptionsCommand.cxx +++ b/Source/cmTargetLinkOptionsCommand.cxx @@ -7,33 +7,44 @@ #include "cmMessageType.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" +#include "cmTargetPropCommandBase.h" -class cmExecutionStatus; +namespace { -bool cmTargetLinkOptionsCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +class TargetLinkOptionsImpl : public cmTargetPropCommandBase { - return this->HandleArguments(args, "LINK_OPTIONS", PROCESS_BEFORE); -} +public: + using cmTargetPropCommandBase::cmTargetPropCommandBase; -void cmTargetLinkOptionsCommand::HandleMissingTarget(const std::string& name) -{ - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Cannot specify link options for target \"", name, - "\" which is not built by this project.")); -} +private: + void HandleMissingTarget(const std::string& name) override + { + this->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Cannot specify link options for target \"", name, + "\" which is not built by this project.")); + } -std::string cmTargetLinkOptionsCommand::Join( - const std::vector<std::string>& content) -{ - return cmJoin(content, ";"); -} + bool HandleDirectContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool /*system*/) override + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + tgt->InsertLinkOption(this->Join(content), lfbt, prepend); + return true; // Successfully handled. + } + + std::string Join(const std::vector<std::string>& content) override + { + return cmJoin(content, ";"); + } +}; + +} // namespace -bool cmTargetLinkOptionsCommand::HandleDirectContent( - cmTarget* tgt, const std::vector<std::string>& content, bool prepend, bool) +bool cmTargetLinkOptionsCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - tgt->InsertLinkOption(this->Join(content), lfbt, prepend); - return true; // Successfully handled. + return TargetLinkOptionsImpl(status).HandleArguments( + args, "LINK_OPTIONS", TargetLinkOptionsImpl::PROCESS_BEFORE); } |