Use one authorative source of the LINK_LIBRARIES property.

We populate and maintain a vector of structs to keep track of
backtraces already, so no need to populate the Properties container
additionally.

For completeness, it is necessary to remove the condition for
populating the vector for only valid library names and generator
expressions. That condition is now determined when evaluating the
generator expressions.
This commit is contained in:
Stephen Kelly 2013-08-06 11:19:56 +02:00
parent 1e11708a56
commit f01dc72c58
1 changed files with 46 additions and 18 deletions

View File

@ -2657,6 +2657,11 @@ void cmTarget::FinalizeSystemIncludeDirectories()
end = this->Internal->LinkInterfacePropertyEntries.end(); end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it) it != end; ++it)
{ {
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
&& cmGeneratorExpression::Find(it->Value) == std::string::npos)
{
continue;
}
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
@ -3033,15 +3038,11 @@ void cmTarget::SetProperty(const char* prop, const char* value)
if (strcmp(prop, "LINK_LIBRARIES") == 0) if (strcmp(prop, "LINK_LIBRARIES") == 0)
{ {
this->Internal->LinkInterfacePropertyEntries.clear(); this->Internal->LinkInterfacePropertyEntries.clear();
if (cmGeneratorExpression::IsValidTargetName(value)
|| cmGeneratorExpression::Find(value) != std::string::npos)
{
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt); cmValueWithOrigin entry(value, lfbt);
this->Internal->LinkInterfacePropertyEntries.push_back(entry); this->Internal->LinkInterfacePropertyEntries.push_back(entry);
} return;
// Fall through
} }
this->Properties.SetProperty(prop, value, cmProperty::TARGET); this->Properties.SetProperty(prop, value, cmProperty::TARGET);
this->MaybeInvalidatePropertyCache(prop); this->MaybeInvalidatePropertyCache(prop);
@ -3099,15 +3100,11 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
} }
if (strcmp(prop, "LINK_LIBRARIES") == 0) if (strcmp(prop, "LINK_LIBRARIES") == 0)
{ {
if (cmGeneratorExpression::IsValidTargetName(value)
|| cmGeneratorExpression::Find(value) != std::string::npos)
{
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt); cmValueWithOrigin entry(value, lfbt);
this->Internal->LinkInterfacePropertyEntries.push_back(entry); this->Internal->LinkInterfacePropertyEntries.push_back(entry);
} return;
// Fall through
} }
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop); this->MaybeInvalidatePropertyCache(prop);
@ -3387,6 +3384,11 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
end = this->Internal->LinkInterfacePropertyEntries.end(); end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it) it != end; ++it)
{ {
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
&& cmGeneratorExpression::Find(it->Value) == std::string::npos)
{
continue;
}
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -3585,6 +3587,11 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
end = this->Internal->LinkInterfacePropertyEntries.end(); end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it) it != end; ++it)
{ {
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
&& cmGeneratorExpression::Find(it->Value) == std::string::npos)
{
continue;
}
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -3693,6 +3700,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
end = this->Internal->LinkInterfacePropertyEntries.end(); end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it) it != end; ++it)
{ {
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
&& cmGeneratorExpression::Find(it->Value) == std::string::npos)
{
continue;
}
{ {
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -4181,6 +4193,22 @@ const char *cmTarget::GetProperty(const char* prop,
} }
return output.c_str(); return output.c_str();
} }
if(strcmp(prop,"LINK_LIBRARIES") == 0)
{
static std::string output;
output = "";
std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkInterfacePropertyEntries.begin(),
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
output += sep;
output += it->Value;
sep = ";";
}
return output.c_str();
}
if (strcmp(prop,"IMPORTED") == 0) if (strcmp(prop,"IMPORTED") == 0)
{ {