summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommands.cxx3
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx26
-rw-r--r--Source/cmGetTargetPropertyCommand.h21
3 files changed, 16 insertions, 34 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index ff19062..9916282 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -229,8 +229,7 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("enable_testing", cmEnableTestingCommand);
state->AddBuiltinCommand("get_source_file_property",
cmGetSourceFilePropertyCommand);
- state->AddBuiltinCommand("get_target_property",
- cm::make_unique<cmGetTargetPropertyCommand>());
+ state->AddBuiltinCommand("get_target_property", cmGetTargetPropertyCommand);
state->AddBuiltinCommand("get_test_property",
cm::make_unique<cmGetTestPropertyCommand>());
state->AddBuiltinCommand("include_directories",
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;
}
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 1a53195..c13078f 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -8,26 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmGetTargetPropertyCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmGetTargetPropertyCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif