mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
cmGeneratorTarget: Track when the set of link libs is config-dependent
Report in `cmLinkImplementationLibraries` and `cmLinkInterfaceLibraries` whether the list of libraries depends on a genex referencing the configuration. We already track whether a genex references the head target.
This commit is contained in:
@@ -5885,6 +5885,7 @@ void cmGeneratorTarget::ExpandLinkItems(
|
||||
std::string const& prop, std::string const& value, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget, bool usage_requirements_only,
|
||||
std::vector<cmLinkItem>& items, bool& hadHeadSensitiveCondition,
|
||||
bool& hadContextSensitiveCondition,
|
||||
bool& hadLinkLanguageSensitiveCondition) const
|
||||
{
|
||||
// Keep this logic in sync with ComputeLinkImplementationLibraries.
|
||||
@@ -5903,6 +5904,7 @@ void cmGeneratorTarget::ExpandLinkItems(
|
||||
libs);
|
||||
this->LookupLinkItems(libs, cge->GetBacktrace(), items);
|
||||
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
|
||||
hadContextSensitiveCondition = cge->GetHadContextSensitiveCondition();
|
||||
hadLinkLanguageSensitiveCondition =
|
||||
cge->GetHadLinkLanguageSensitiveCondition();
|
||||
}
|
||||
@@ -6407,6 +6409,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
||||
this->ExpandLinkItems(linkIfaceProp, *explicitLibraries, config,
|
||||
headTarget, usage_requirements_only, iface.Libraries,
|
||||
iface.HadHeadSensitiveCondition,
|
||||
iface.HadContextSensitiveCondition,
|
||||
iface.HadLinkLanguageSensitiveCondition);
|
||||
} else if (!cmp0022NEW)
|
||||
// If CMP0022 is NEW then the plain tll signature sets the
|
||||
@@ -6427,10 +6430,12 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
||||
static const std::string newProp = "INTERFACE_LINK_LIBRARIES";
|
||||
if (cmProp newExplicitLibraries = this->GetProperty(newProp)) {
|
||||
bool hadHeadSensitiveConditionDummy = false;
|
||||
bool hadContextSensitiveConditionDummy = false;
|
||||
bool hadLinkLanguageSensitiveConditionDummy = false;
|
||||
this->ExpandLinkItems(newProp, *newExplicitLibraries, config,
|
||||
headTarget, usage_requirements_only, ifaceLibs,
|
||||
hadHeadSensitiveConditionDummy,
|
||||
hadContextSensitiveConditionDummy,
|
||||
hadLinkLanguageSensitiveConditionDummy);
|
||||
}
|
||||
if (ifaceLibs != iface.Libraries) {
|
||||
@@ -6498,6 +6503,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
|
||||
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
|
||||
headTarget, usage_requirements_only, iface.Libraries,
|
||||
iface.HadHeadSensitiveCondition,
|
||||
iface.HadContextSensitiveCondition,
|
||||
iface.HadLinkLanguageSensitiveCondition);
|
||||
std::vector<std::string> deps = cmExpandedList(info->SharedDeps);
|
||||
this->LookupLinkItems(deps, cmListFileBacktrace(), iface.SharedDeps);
|
||||
@@ -7020,6 +7026,9 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
if (cge->GetHadHeadSensitiveCondition()) {
|
||||
impl.HadHeadSensitiveCondition = true;
|
||||
}
|
||||
if (cge->GetHadContextSensitiveCondition()) {
|
||||
impl.HadContextSensitiveCondition = true;
|
||||
}
|
||||
if (cge->GetHadLinkLanguageSensitiveCondition()) {
|
||||
impl.HadLinkLanguageSensitiveCondition = true;
|
||||
}
|
||||
|
||||
@@ -989,6 +989,7 @@ private:
|
||||
bool usage_requirements_only,
|
||||
std::vector<cmLinkItem>& items,
|
||||
bool& hadHeadSensitiveCondition,
|
||||
bool& hadContextSensitiveCondition,
|
||||
bool& hadLinkLanguageSensitiveCondition) const;
|
||||
void LookupLinkItems(std::vector<std::string> const& names,
|
||||
cmListFileBacktrace const& bt,
|
||||
|
||||
@@ -54,6 +54,9 @@ struct cmLinkImplementationLibraries
|
||||
// Libraries linked directly in other configurations.
|
||||
// Needed only for OLD behavior of CMP0003.
|
||||
std::vector<cmLinkItem> WrongConfigLibraries;
|
||||
|
||||
// Whether the list depends on a genex referencing the configuration.
|
||||
bool HadContextSensitiveCondition = false;
|
||||
};
|
||||
|
||||
struct cmLinkInterfaceLibraries
|
||||
@@ -63,6 +66,9 @@ struct cmLinkInterfaceLibraries
|
||||
|
||||
// Whether the list depends on a genex referencing the head target.
|
||||
bool HadHeadSensitiveCondition = false;
|
||||
|
||||
// Whether the list depends on a genex referencing the configuration.
|
||||
bool HadContextSensitiveCondition = false;
|
||||
};
|
||||
|
||||
struct cmLinkInterface : public cmLinkInterfaceLibraries
|
||||
|
||||
Reference in New Issue
Block a user