diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-09-12 08:13:17 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-09-12 16:16:17 (GMT) |
commit | 0b95c64e43e5f60ee9c60570f359a40e4e882096 (patch) | |
tree | 720d3f4c7c1f966bccffde8d23666bdfa2581a9c /Source/cmGetTargetPropertyCommand.cxx | |
parent | e4c67981aca4fd736fd7503d9d105a0a6fb43828 (diff) | |
download | CMake-0b95c64e43e5f60ee9c60570f359a40e4e882096.zip CMake-0b95c64e43e5f60ee9c60570f359a40e4e882096.tar.gz CMake-0b95c64e43e5f60ee9c60570f359a40e4e882096.tar.bz2 |
cmGetTargetPropertyCommand: Port away from cmCommand
Ref: #19499
Diffstat (limited to 'Source/cmGetTargetPropertyCommand.cxx')
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 07aaf02..7f5df9c 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -4,6 +4,7 @@ #include <sstream> +#include "cmExecutionStatus.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -11,32 +12,31 @@ #include "cmTarget.h" #include "cmTargetPropertyComputer.h" -class cmExecutionStatus; class cmMessenger; -// cmSetTargetPropertyCommand -bool cmGetTargetPropertyCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmGetTargetPropertyCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() != 3) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } std::string const& var = args[0]; std::string const& targetName = args[1]; std::string prop; bool prop_exists = false; + cmMakefile& mf = status.GetMakefile(); - if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { + if (cmTarget* tgt = mf.FindTargetToUse(targetName)) { if (args[2] == "ALIASED_TARGET") { - if (this->Makefile->IsAlias(targetName)) { + if (mf.IsAlias(targetName)) { prop = tgt->GetName(); prop_exists = true; } } else if (!args[2].empty()) { const char* prop_cstr = nullptr; - cmListFileBacktrace bt = this->Makefile->GetBacktrace(); - cmMessenger* messenger = this->Makefile->GetMessenger(); + cmListFileBacktrace bt = mf.GetBacktrace(); + cmMessenger* messenger = mf.GetMessenger(); if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2], messenger, bt)) { prop_cstr = tgt->GetComputedProperty(args[2], messenger, bt); @@ -53,7 +53,7 @@ bool cmGetTargetPropertyCommand::InitialPass( bool issueMessage = false; std::ostringstream e; MessageType messageType = MessageType::AUTHOR_WARNING; - switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0045)) { + switch (mf.GetPolicyStatus(cmPolicies::CMP0045)) { case cmPolicies::WARN: issueMessage = true; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n"; @@ -68,16 +68,16 @@ bool cmGetTargetPropertyCommand::InitialPass( if (issueMessage) { e << "get_target_property() called with non-existent target \"" << targetName << "\"."; - this->Makefile->IssueMessage(messageType, e.str()); + mf.IssueMessage(messageType, e.str()); if (messageType == MessageType::FATAL_ERROR) { return false; } } } if (prop_exists) { - this->Makefile->AddDefinition(var, prop); + mf.AddDefinition(var, prop); return true; } - this->Makefile->AddDefinition(var, var + "-NOTFOUND"); + mf.AddDefinition(var, var + "-NOTFOUND"); return true; } |