diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 7c49c9ac47923e15d23b4f83cd563d2f143cd70f..854fdb8716bee8c10a8c57e052a9a8c4fd0aaadf 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -248,15 +248,14 @@ bool cmGetPropertyCommand::HandleTargetMode()
     return false;
   }
 
-  if (this->PropertyName == "ALIASED_TARGET") {
-    if (this->Makefile->IsAlias(this->Name)) {
-      if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) {
+  if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) {
+    if (this->PropertyName == "ALIASED_TARGET") {
+      if (this->Makefile->IsAlias(this->Name)) {
         return this->StoreResult(target->GetName().c_str());
+      } else {
+        return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
       }
     }
-    return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
-  }
-  if (cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) {
     return this->StoreResult(
       target->GetProperty(this->PropertyName, this->Makefile));
   } else {
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 228ec6931f174eeb975d6fc66f056fec37b414ee..073cf32e58e8c3b6588257b77bd2a202eba0e6dc 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 = CM_NULLPTR;
-    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;