diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-09-18 15:34:23 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-09-21 03:12:31 (GMT) |
commit | fcfec154acea01518aa436d76f576d7cfea65fa2 (patch) | |
tree | 386a007f6c63ac6bc34d24c4b2f2104a231ccf27 /Source/cmLinkDirectoriesCommand.cxx | |
parent | d038beec21fde74977e6ce6604f7fc913066dad6 (diff) | |
download | CMake-fcfec154acea01518aa436d76f576d7cfea65fa2.zip CMake-fcfec154acea01518aa436d76f576d7cfea65fa2.tar.gz CMake-fcfec154acea01518aa436d76f576d7cfea65fa2.tar.bz2 |
cmLinkDirectoriesCommand: Port away from cmCommand
Diffstat (limited to 'Source/cmLinkDirectoriesCommand.cxx')
-rw-r--r-- | Source/cmLinkDirectoriesCommand.cxx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 57b69c8..2914046 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -4,6 +4,7 @@ #include <sstream> +#include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -11,17 +12,18 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; +static void AddLinkDir(cmMakefile& mf, std::string const& dir, + std::vector<std::string>& directories); -// cmLinkDirectoriesCommand -bool cmLinkDirectoriesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmLinkDirectoriesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.empty()) { return true; } - bool before = this->Makefile->IsOn("CMAKE_LINK_DIRECTORIES_BEFORE"); + cmMakefile& mf = status.GetMakefile(); + bool before = mf.IsOn("CMAKE_LINK_DIRECTORIES_BEFORE"); auto i = args.cbegin(); if ((*i) == "BEFORE") { @@ -34,16 +36,16 @@ bool cmLinkDirectoriesCommand::InitialPass( std::vector<std::string> directories; for (; i != args.cend(); ++i) { - this->AddLinkDir(*i, directories); + AddLinkDir(mf, *i, directories); } - this->Makefile->AddLinkDirectory(cmJoin(directories, ";"), before); + mf.AddLinkDirectory(cmJoin(directories, ";"), before); return true; } -void cmLinkDirectoriesCommand::AddLinkDir( - std::string const& dir, std::vector<std::string>& directories) +static void AddLinkDir(cmMakefile& mf, std::string const& dir, + std::vector<std::string>& directories) { std::string unixPath = dir; cmSystemTools::ConvertToUnixSlashes(unixPath); @@ -56,10 +58,10 @@ void cmLinkDirectoriesCommand::AddLinkDir( << " " << unixPath << "\n" << "as a link directory.\n"; /* clang-format on */ - switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) { + switch (mf.GetPolicyStatus(cmPolicies::CMP0015)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015); - this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str()); + mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); break; case cmPolicies::OLD: // OLD behavior does not convert @@ -67,7 +69,7 @@ void cmLinkDirectoriesCommand::AddLinkDir( case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015); - this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf.IssueMessage(MessageType::FATAL_ERROR, e.str()); CM_FALLTHROUGH; case cmPolicies::NEW: // NEW behavior converts @@ -75,9 +77,7 @@ void cmLinkDirectoriesCommand::AddLinkDir( break; } if (convertToAbsolute) { - std::string tmp = - cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', unixPath); - unixPath = tmp; + unixPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', unixPath); } } directories.push_back(unixPath); |