cmTarget: Split storage of link implementation from backtraces.
This commit is contained in:
parent
370bb92c10
commit
a8429a402d
@ -111,13 +111,4 @@ struct cmListFile
|
|||||||
std::vector<cmListFileFunction> Functions;
|
std::vector<cmListFileFunction> Functions;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmValueWithOrigin {
|
|
||||||
cmValueWithOrigin(const std::string &value,
|
|
||||||
const cmListFileBacktrace &bt)
|
|
||||||
: Value(value), Backtrace(bt)
|
|
||||||
{}
|
|
||||||
std::string Value;
|
|
||||||
cmListFileBacktrace Backtrace;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -114,7 +114,8 @@ public:
|
|||||||
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||||
std::vector<std::string> SourceEntries;
|
std::vector<std::string> SourceEntries;
|
||||||
std::vector<cmListFileBacktrace> SourceBacktraces;
|
std::vector<cmListFileBacktrace> SourceBacktraces;
|
||||||
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
std::vector<std::string> LinkImplementationPropertyEntries;
|
||||||
|
std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -1380,11 +1381,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
|||||||
else if (prop == "LINK_LIBRARIES")
|
else if (prop == "LINK_LIBRARIES")
|
||||||
{
|
{
|
||||||
this->Internal->LinkImplementationPropertyEntries.clear();
|
this->Internal->LinkImplementationPropertyEntries.clear();
|
||||||
|
this->Internal->LinkImplementationPropertyBacktraces.clear();
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||||
cmValueWithOrigin entry(value, lfbt);
|
this->Internal->LinkImplementationPropertyEntries.push_back(value);
|
||||||
this->Internal->LinkImplementationPropertyEntries.push_back(entry);
|
this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (prop == "SOURCES")
|
else if (prop == "SOURCES")
|
||||||
@ -1482,8 +1484,8 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|||||||
if (value && *value)
|
if (value && *value)
|
||||||
{
|
{
|
||||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||||
cmValueWithOrigin entry(value, lfbt);
|
this->Internal->LinkImplementationPropertyEntries.push_back(value);
|
||||||
this->Internal->LinkImplementationPropertyEntries.push_back(entry);
|
this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (prop == "SOURCES")
|
else if (prop == "SOURCES")
|
||||||
@ -2048,17 +2050,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::string output;
|
static std::string output;
|
||||||
output = "";
|
output = cmJoin(this->Internal->LinkImplementationPropertyEntries, ";");
|
||||||
std::string sep;
|
|
||||||
for (std::vector<cmValueWithOrigin>::const_iterator
|
|
||||||
it = this->Internal->LinkImplementationPropertyEntries.begin(),
|
|
||||||
end = this->Internal->LinkImplementationPropertyEntries.end();
|
|
||||||
it != end; ++it)
|
|
||||||
{
|
|
||||||
output += sep;
|
|
||||||
output += it->Value;
|
|
||||||
sep = ";";
|
|
||||||
}
|
|
||||||
return output.c_str();
|
return output.c_str();
|
||||||
}
|
}
|
||||||
// the type property returns what type the target is
|
// the type property returns what type the target is
|
||||||
@ -3223,19 +3215,21 @@ void cmTarget::ComputeLinkImplementationLibraries(
|
|||||||
cmOptionalLinkImplementation& impl,
|
cmOptionalLinkImplementation& impl,
|
||||||
cmTarget const* head) const
|
cmTarget const* head) const
|
||||||
{
|
{
|
||||||
|
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
||||||
|
this->Internal->LinkImplementationPropertyBacktraces.begin();
|
||||||
// Collect libraries directly linked in this configuration.
|
// Collect libraries directly linked in this configuration.
|
||||||
for (std::vector<cmValueWithOrigin>::const_iterator
|
for (std::vector<std::string>::const_iterator
|
||||||
le = this->Internal->LinkImplementationPropertyEntries.begin(),
|
le = this->Internal->LinkImplementationPropertyEntries.begin(),
|
||||||
end = this->Internal->LinkImplementationPropertyEntries.end();
|
end = this->Internal->LinkImplementationPropertyEntries.end();
|
||||||
le != end; ++le)
|
le != end; ++le, ++btIt)
|
||||||
{
|
{
|
||||||
std::vector<std::string> llibs;
|
std::vector<std::string> llibs;
|
||||||
cmGeneratorExpressionDAGChecker dagChecker(
|
cmGeneratorExpressionDAGChecker dagChecker(
|
||||||
this->GetName(),
|
this->GetName(),
|
||||||
"LINK_LIBRARIES", 0, 0);
|
"LINK_LIBRARIES", 0, 0);
|
||||||
cmGeneratorExpression ge(le->Backtrace);
|
cmGeneratorExpression ge(*btIt);
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
|
||||||
ge.Parse(le->Value);
|
ge.Parse(*le);
|
||||||
std::string const evaluated =
|
std::string const evaluated =
|
||||||
cge->Evaluate(this->Makefile, config, false, head, &dagChecker);
|
cge->Evaluate(this->Makefile, config, false, head, &dagChecker);
|
||||||
cmSystemTools::ExpandListArgument(evaluated, llibs);
|
cmSystemTools::ExpandListArgument(evaluated, llibs);
|
||||||
@ -3290,7 +3284,7 @@ void cmTarget::ComputeLinkImplementationLibraries(
|
|||||||
// The entry is meant for this configuration.
|
// The entry is meant for this configuration.
|
||||||
impl.Libraries.push_back(
|
impl.Libraries.push_back(
|
||||||
cmLinkImplItem(name, this->FindTargetToLink(name),
|
cmLinkImplItem(name, this->FindTargetToLink(name),
|
||||||
le->Backtrace, evaluated != le->Value));
|
*btIt, evaluated != *le));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();
|
std::set<std::string> const& seenProps = cge->GetSeenTargetProperties();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user