cmGeneratorTarget: Fix link interface caching of partial results
`GetLinkInterface` and `GetLinkInterfaceLibraries` cache their results to avoid repeating work. In the case that the result does not depend on the "head" target, they re-use results computed from the first call with any "head" target. However, if `GetLinkInterfaceLibraries` is called first, then not all of the link interface is populated. If `GetLinkInterface` is later called, it needs to finish populating the link interface even if a partially completed interface was cached.
This commit is contained in:
parent
d75ab9d066
commit
f3d2eab36a
@ -6746,17 +6746,16 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
|
||||
// Lookup any existing link interface for this configuration.
|
||||
cmHeadToLinkInterfaceMap& hm = this->GetHeadToLinkInterfaceMap(config);
|
||||
|
||||
if (secondPass) {
|
||||
hm.erase(head);
|
||||
}
|
||||
|
||||
// If the link interface does not depend on the head target
|
||||
// then return the one we computed first.
|
||||
// then re-use the one from the head we computed first.
|
||||
if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) {
|
||||
return &hm.begin()->second;
|
||||
head = hm.begin()->first;
|
||||
}
|
||||
|
||||
cmOptionalLinkInterface& iface = hm[head];
|
||||
if (secondPass) {
|
||||
iface = cmOptionalLinkInterface();
|
||||
}
|
||||
if (!iface.LibrariesDone) {
|
||||
iface.LibrariesDone = true;
|
||||
this->ComputeLinkInterfaceLibraries(config, iface, head,
|
||||
@ -6875,9 +6874,9 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
|
||||
: this->GetHeadToLinkInterfaceMap(config));
|
||||
|
||||
// If the link interface does not depend on the head target
|
||||
// then return the one we computed first.
|
||||
// then re-use the one from the head we computed first.
|
||||
if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) {
|
||||
return &hm.begin()->second;
|
||||
head = hm.begin()->first;
|
||||
}
|
||||
|
||||
cmOptionalLinkInterface& iface = hm[head];
|
||||
@ -7381,17 +7380,16 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
|
||||
? this->GetHeadToLinkInterfaceUsageRequirementsMap(config)
|
||||
: this->GetHeadToLinkInterfaceMap(config));
|
||||
|
||||
if (secondPass) {
|
||||
hm.erase(headTarget);
|
||||
}
|
||||
|
||||
// If the link interface does not depend on the head target
|
||||
// then return the one we computed first.
|
||||
// then re-use the one from the head we computed first.
|
||||
if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) {
|
||||
return &hm.begin()->second;
|
||||
headTarget = hm.begin()->first;
|
||||
}
|
||||
|
||||
cmOptionalLinkInterface& iface = hm[headTarget];
|
||||
if (secondPass) {
|
||||
iface = cmOptionalLinkInterface();
|
||||
}
|
||||
if (!iface.AllDone) {
|
||||
iface.AllDone = true;
|
||||
iface.LibrariesDone = true;
|
||||
@ -7905,9 +7903,9 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
|
||||
this->LinkImplMap[cmSystemTools::UpperCase(config)];
|
||||
|
||||
// If the link implementation does not depend on the head target
|
||||
// then return the one we computed first.
|
||||
// then re-use the one from the head we computed first.
|
||||
if (!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition) {
|
||||
return &hm.begin()->second;
|
||||
head = hm.begin()->first;
|
||||
}
|
||||
|
||||
cmOptionalLinkImplementation& impl = hm[head];
|
||||
|
Loading…
Reference in New Issue
Block a user