summaryrefslogtreecommitdiffstats
path: root/Source/cmGetTargetPropertyCommand.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2016-06-26 20:00:00 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2016-06-26 20:00:00 (GMT)
commit2ca76a6651dd16586334067f6a41524a4015adc9 (patch)
tree3b166af5ccf81ef640bf03dad6fc97f129e063b0 /Source/cmGetTargetPropertyCommand.cxx
parentc68cf9e4d111fa7c92973acec92d71ce6d187ff9 (diff)
downloadCMake-2ca76a6651dd16586334067f6a41524a4015adc9.zip
CMake-2ca76a6651dd16586334067f6a41524a4015adc9.tar.gz
CMake-2ca76a6651dd16586334067f6a41524a4015adc9.tar.bz2
Validate target name in ALIASED_TARGET property getter
Diffstat (limited to 'Source/cmGetTargetPropertyCommand.cxx')
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx24
1 files changed, 10 insertions, 14 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index dded9f7..073cf32 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -24,22 +24,18 @@ bool cmGetTargetPropertyCommand::InitialPass(
std::string prop;
bool prop_exists = false;
- if (args[2] == "ALIASED_TARGET") {
- if (this->Makefile->IsAlias(targetName)) {
- if (cmTarget* target = this->Makefile->FindTargetToUse(targetName)) {
- prop = target->GetName();
+ if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) {
+ if (args[2] == "ALIASED_TARGET") {
+ if (this->Makefile->IsAlias(targetName)) {
+ prop = tgt->GetName();
+ prop_exists = true;
+ }
+ } else if (!args[2].empty()) {
+ const char* prop_cstr = tgt->GetProperty(args[2], this->Makefile);
+ if (prop_cstr) {
+ prop = prop_cstr;
prop_exists = true;
}
- }
- } else if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) {
- cmTarget& target = *tgt;
- const char* prop_cstr = 0;
- if (!args[2].empty()) {
- prop_cstr = target.GetProperty(args[2], this->Makefile);
- }
- if (prop_cstr) {
- prop = prop_cstr;
- prop_exists = true;
}
} else {
bool issueMessage = false;