diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-09-10 19:41:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-26 17:27:55 (GMT) |
commit | 9d1a1bc495be41b035f61f9b707df8006da54160 (patch) | |
tree | a1b41bb5a94b7ca5c8fdae2a1258581c59a62eb6 /Source/cmTargetLinkDirectoriesCommand.cxx | |
parent | dcc117b9446cfc3d6c8bf191545aac8d1519abca (diff) | |
download | CMake-9d1a1bc495be41b035f61f9b707df8006da54160.zip CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.gz CMake-9d1a1bc495be41b035f61f9b707df8006da54160.tar.bz2 |
cmTarget*: Port away from cmCommand
Diffstat (limited to 'Source/cmTargetLinkDirectoriesCommand.cxx')
-rw-r--r-- | Source/cmTargetLinkDirectoriesCommand.cxx | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/Source/cmTargetLinkDirectoriesCommand.cxx b/Source/cmTargetLinkDirectoriesCommand.cxx index c2ef6c1..0c68d60 100644 --- a/Source/cmTargetLinkDirectoriesCommand.cxx +++ b/Source/cmTargetLinkDirectoriesCommand.cxx @@ -9,25 +9,37 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmTargetPropCommandBase.h" -class cmExecutionStatus; +namespace { -bool cmTargetLinkDirectoriesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +class TargetLinkDirectoriesImpl : public cmTargetPropCommandBase { - return this->HandleArguments(args, "LINK_DIRECTORIES", PROCESS_BEFORE); -} +public: + using cmTargetPropCommandBase::cmTargetPropCommandBase; -void cmTargetLinkDirectoriesCommand::HandleMissingTarget( - const std::string& name) -{ - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("Cannot specify link directories 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 directories for target \"", name, + "\" which is not built by this project.")); + } + + std::string Join(const std::vector<std::string>& content) override; -std::string cmTargetLinkDirectoriesCommand::Join( + bool HandleDirectContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool /*system*/) override + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + tgt->InsertLinkDirectory(this->Join(content), lfbt, prepend); + return true; // Successfully handled. + } +}; + +std::string TargetLinkDirectoriesImpl::Join( const std::vector<std::string>& content) { std::vector<std::string> directories; @@ -48,12 +60,11 @@ std::string cmTargetLinkDirectoriesCommand::Join( return cmJoin(directories, ";"); } -bool cmTargetLinkDirectoriesCommand::HandleDirectContent( - cmTarget* tgt, const std::vector<std::string>& content, bool prepend, bool) -{ - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); +} // namespace - tgt->InsertLinkDirectory(this->Join(content), lfbt, prepend); - - return true; // Successfully handled. +bool cmTargetLinkDirectoriesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + return TargetLinkDirectoriesImpl(status).HandleArguments( + args, "LINK_DIRECTORIES", TargetLinkDirectoriesImpl::PROCESS_BEFORE); } |