cmTarget: Create a temporary cmTarget in checkInterfacePropertyCompatibility

This simplifies further refactoring.
This commit is contained in:
Stephen Kelly 2014-02-12 13:48:47 +01:00
parent b8b99cc1e5
commit a6dd4990db
1 changed files with 9 additions and 8 deletions

View File

@ -4459,23 +4459,24 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
// target itself has a POSITION_INDEPENDENT_CODE which disagrees // target itself has a POSITION_INDEPENDENT_CODE which disagrees
// with a dependency. // with a dependency.
if (!li->Target) cmTarget const* theTarget = li->Target;
if (!theTarget)
{ {
continue; continue;
} }
const bool ifaceIsSet = li->Target->GetProperties() const bool ifaceIsSet = theTarget->GetProperties()
.find("INTERFACE_" + p) .find("INTERFACE_" + p)
!= li->Target->GetProperties().end(); != theTarget->GetProperties().end();
PropertyType ifacePropContent = PropertyType ifacePropContent =
getTypedProperty<PropertyType>(li->Target, getTypedProperty<PropertyType>(theTarget,
("INTERFACE_" + p).c_str(), 0); ("INTERFACE_" + p).c_str(), 0);
std::string reportEntry; std::string reportEntry;
if (ifaceIsSet) if (ifaceIsSet)
{ {
reportEntry += " * Target \""; reportEntry += " * Target \"";
reportEntry += li->Target->GetName(); reportEntry += theTarget->GetName();
reportEntry += "\" property value \""; reportEntry += "\" property value \"";
reportEntry += valueAsString<PropertyType>(ifacePropContent); reportEntry += valueAsString<PropertyType>(ifacePropContent);
reportEntry += "\" "; reportEntry += "\" ";
@ -4496,7 +4497,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
e << "Property " << p << " on target \"" e << "Property " << p << " on target \""
<< tgt->GetName() << "\" does\nnot match the " << tgt->GetName() << "\" does\nnot match the "
"INTERFACE_" << p << " property requirement\nof " "INTERFACE_" << p << " property requirement\nof "
"dependency \"" << li->Target->GetName() << "\".\n"; "dependency \"" << theTarget->GetName() << "\".\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str().c_str());
break; break;
} }
@ -4530,7 +4531,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
<< tgt->GetName() << "\" is\nimplied to be " << defaultValue << tgt->GetName() << "\" is\nimplied to be " << defaultValue
<< " because it was used to determine the link libraries\n" << " because it was used to determine the link libraries\n"
"already. The INTERFACE_" << p << " property on\ndependency \"" "already. The INTERFACE_" << p << " property on\ndependency \""
<< li->Target->GetName() << "\" is in conflict.\n"; << theTarget->GetName() << "\" is in conflict.\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str().c_str());
break; break;
} }
@ -4561,7 +4562,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{ {
cmOStringStream e; cmOStringStream e;
e << "The INTERFACE_" << p << " property of \"" e << "The INTERFACE_" << p << " property of \""
<< li->Target->GetName() << "\" does\nnot agree with the value " << theTarget->GetName() << "\" does\nnot agree with the value "
"of " << p << " already determined\nfor \"" "of " << p << " already determined\nfor \""
<< tgt->GetName() << "\".\n"; << tgt->GetName() << "\".\n";
cmSystemTools::Error(e.str().c_str()); cmSystemTools::Error(e.str().c_str());