get_target_property: discern empty from undefined properties (#15333)

This was accidentally regressed by commit v3.1.0-rc1~812^2~50
(stringapi: Use strings for property names, 2013-09-02).
This commit is contained in:
Stephen Kelly 2015-01-08 15:20:38 -05:00 committed by Brad King
parent c118816d44
commit 34a990946c
1 changed files with 4 additions and 1 deletions

View File

@ -23,6 +23,7 @@ bool cmGetTargetPropertyCommand
std::string var = args[0]; std::string var = args[0];
const std::string& targetName = args[1]; const std::string& targetName = args[1];
std::string prop; std::string prop;
bool prop_exists = false;
if(args[2] == "ALIASED_TARGET") if(args[2] == "ALIASED_TARGET")
{ {
@ -32,6 +33,7 @@ bool cmGetTargetPropertyCommand
this->Makefile->FindTargetToUse(targetName)) this->Makefile->FindTargetToUse(targetName))
{ {
prop = target->GetName(); prop = target->GetName();
prop_exists = true;
} }
} }
} }
@ -42,6 +44,7 @@ bool cmGetTargetPropertyCommand
if(prop_cstr) if(prop_cstr)
{ {
prop = prop_cstr; prop = prop_cstr;
prop_exists = true;
} }
} }
else else
@ -74,7 +77,7 @@ bool cmGetTargetPropertyCommand
} }
} }
} }
if (!prop.empty()) if (prop_exists)
{ {
this->Makefile->AddDefinition(var, prop.c_str()); this->Makefile->AddDefinition(var, prop.c_str());
return true; return true;