cmGeneratorTarget: Clarify enum for specifying purpose of usage requirements
Since commit 1e49880472
(cmGeneratorTarget: Avoid boolean trap in usage
requirement lookup, 2021-12-08, v3.23.0-rc1~245^2) we have clarified
the distinction between compile-only and link-only usage requirements.
Rename the `LinkInterfaceFor` enum to `UseTo` to clarify that its role
is to specify the purpose of usage requirements.
stage/master/nightly/2024/05/04^2
parent
662d4c5315
commit
ff1693cb3c
|
@ -854,7 +854,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
|
|||
{
|
||||
// Add direct link dependencies in this configuration.
|
||||
cmLinkImplementation const* impl = this->Target->GetLinkImplementation(
|
||||
this->Config, cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
this->Config, cmGeneratorTarget::UseTo::Link);
|
||||
this->AddLinkEntries(cmComputeComponentGraph::INVALID_COMPONENT,
|
||||
impl->Libraries);
|
||||
this->AddLinkObjects(impl->Objects);
|
||||
|
|
|
@ -220,7 +220,7 @@ void cmComputeTargetDepends::CollectTargetDepends(size_t depender_index)
|
|||
emitted.insert(cmLinkItem(depender, true, cmListFileBacktrace()));
|
||||
|
||||
if (cmLinkImplementation const* impl = depender->GetLinkImplementation(
|
||||
it, cmGeneratorTarget::LinkInterfaceFor::Link)) {
|
||||
it, cmGeneratorTarget::UseTo::Link)) {
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
// Don't emit the same library twice for this target.
|
||||
if (emitted.insert(lib).second) {
|
||||
|
|
|
@ -55,7 +55,7 @@ void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
|||
std::string const& lang,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
cmGeneratorTarget::LinkInterfaceFor interfaceFor,
|
||||
cmGeneratorTarget::UseTo usage,
|
||||
std::vector<cmLinkImplItem> const& libraries)
|
||||
{
|
||||
for (cmLinkImplItem const& lib : libraries) {
|
||||
|
@ -67,8 +67,8 @@ void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
|||
cmGeneratorExpressionContext context(
|
||||
headTarget->GetLocalGenerator(), config, false, headTarget, headTarget,
|
||||
true, lib.Backtrace, lang);
|
||||
cmExpandList(lib.Target->EvaluateInterfaceProperty(
|
||||
prop, &context, dagChecker, interfaceFor),
|
||||
cmExpandList(lib.Target->EvaluateInterfaceProperty(prop, &context,
|
||||
dagChecker, usage),
|
||||
ee.Values);
|
||||
ee.ContextDependent = context.HadContextSensitiveCondition;
|
||||
entries.Entries.emplace_back(std::move(ee));
|
||||
|
@ -83,29 +83,29 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
|||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
cmGeneratorTarget::LinkInterfaceFor interfaceFor)
|
||||
cmGeneratorTarget::UseTo usage)
|
||||
{
|
||||
if (searchRuntime == IncludeRuntimeInterface::Yes) {
|
||||
if (cmLinkImplementation const* impl =
|
||||
headTarget->GetLinkImplementation(config, interfaceFor)) {
|
||||
headTarget->GetLinkImplementation(config, usage)) {
|
||||
entries.HadContextSensitiveCondition =
|
||||
impl->HadContextSensitiveCondition;
|
||||
|
||||
auto runtimeLibIt = impl->LanguageRuntimeLibraries.find(lang);
|
||||
if (runtimeLibIt != impl->LanguageRuntimeLibraries.end()) {
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
interfaceFor, runtimeLibIt->second);
|
||||
usage, runtimeLibIt->second);
|
||||
}
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
interfaceFor, impl->Libraries);
|
||||
usage, impl->Libraries);
|
||||
}
|
||||
} else {
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(config, interfaceFor)) {
|
||||
headTarget->GetLinkImplementationLibraries(config, usage)) {
|
||||
entries.HadContextSensitiveCondition =
|
||||
impl->HadContextSensitiveCondition;
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
interfaceFor, impl->Libraries);
|
||||
usage, impl->Libraries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,11 +70,10 @@ enum class IncludeRuntimeInterface
|
|||
No
|
||||
};
|
||||
|
||||
void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config, std::string const& prop,
|
||||
std::string const& lang,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
cmGeneratorTarget::LinkInterfaceFor interfaceFor =
|
||||
cmGeneratorTarget::LinkInterfaceFor::Compile);
|
||||
void AddInterfaceEntries(
|
||||
cmGeneratorTarget const* headTarget, std::string const& config,
|
||||
std::string const& prop, std::string const& lang,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile);
|
||||
|
|
|
@ -109,8 +109,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
|
|||
std::string sharedLibs;
|
||||
std::string ldlibs;
|
||||
cmLinkInterfaceLibraries const* linkIFace =
|
||||
target->GetLinkInterfaceLibraries(
|
||||
config, target, cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
target->GetLinkInterfaceLibraries(config, target,
|
||||
cmGeneratorTarget::UseTo::Link);
|
||||
for (cmLinkItem const& item : linkIFace->Libraries) {
|
||||
cmGeneratorTarget const* gt = item.Target;
|
||||
std::string const& lib = item.AsStr();
|
||||
|
@ -170,8 +170,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
|
|||
|
||||
// Tell the NDK build system if prebuilt static libraries use C++.
|
||||
if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
|
||||
cmLinkImplementation const* li = target->GetLinkImplementation(
|
||||
config, cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
cmLinkImplementation const* li =
|
||||
target->GetLinkImplementation(config, cmGeneratorTarget::UseTo::Link);
|
||||
if (cm::contains(li->Languages, "CXX")) {
|
||||
os << "LOCAL_HAS_CPP := true\n";
|
||||
}
|
||||
|
|
|
@ -2701,13 +2701,12 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
|
|||
static std::string getLinkedTargetsContent(
|
||||
cmGeneratorTarget const* target, std::string const& prop,
|
||||
cmGeneratorExpressionContext* context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget::LinkInterfaceFor interfaceFor)
|
||||
cmGeneratorExpressionDAGChecker* dagChecker, cmGeneratorTarget::UseTo usage)
|
||||
{
|
||||
std::string result;
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
target->GetLinkImplementationLibraries(
|
||||
context->Config, cmGeneratorTarget::LinkInterfaceFor::Compile)) {
|
||||
context->Config, cmGeneratorTarget::UseTo::Compile)) {
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
if (lib.Target) {
|
||||
// Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
|
||||
|
@ -2718,7 +2717,7 @@ static std::string getLinkedTargetsContent(
|
|||
target, context->EvaluateForBuildsystem, lib.Backtrace,
|
||||
context->Language);
|
||||
std::string libResult = lib.Target->EvaluateInterfaceProperty(
|
||||
prop, &libContext, dagChecker, interfaceFor);
|
||||
prop, &libContext, dagChecker, usage);
|
||||
if (!libResult.empty()) {
|
||||
if (result.empty()) {
|
||||
result = std::move(libResult);
|
||||
|
@ -2876,14 +2875,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
|||
|
||||
std::string interfacePropertyName;
|
||||
bool isInterfaceProperty = false;
|
||||
cmGeneratorTarget::LinkInterfaceFor interfaceFor =
|
||||
cmGeneratorTarget::LinkInterfaceFor::Compile;
|
||||
cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile;
|
||||
|
||||
if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
|
||||
target->IsTransitiveProperty(propertyName, context->LG)) {
|
||||
interfacePropertyName = std::string(transitiveProp->InterfaceName);
|
||||
isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
|
||||
interfaceFor = transitiveProp->InterfaceFor;
|
||||
usage = transitiveProp->Usage;
|
||||
}
|
||||
|
||||
bool evaluatingLinkLibraries = false;
|
||||
|
@ -2914,7 +2912,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
|||
if (isInterfaceProperty) {
|
||||
return cmGeneratorExpression::StripEmptyListElements(
|
||||
target->EvaluateInterfaceProperty(propertyName, context,
|
||||
dagCheckerParent, interfaceFor));
|
||||
dagCheckerParent, usage));
|
||||
}
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, target,
|
||||
|
@ -3001,7 +2999,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
|||
this->EvaluateDependentExpression(result, context->LG, context, target,
|
||||
&dagChecker, target));
|
||||
std::string linkedTargetsContent = getLinkedTargetsContent(
|
||||
target, interfacePropertyName, context, &dagChecker, interfaceFor);
|
||||
target, interfacePropertyName, context, &dagChecker, usage);
|
||||
if (!linkedTargetsContent.empty()) {
|
||||
result += (result.empty() ? "" : ";") + linkedTargetsContent;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#include "cmake.h"
|
||||
|
||||
namespace {
|
||||
using LinkInterfaceFor = cmGeneratorTarget::LinkInterfaceFor;
|
||||
using UseTo = cmGeneratorTarget::UseTo;
|
||||
using TransitiveProperty = cmGeneratorTarget::TransitiveProperty;
|
||||
|
||||
const std::string kINTERFACE_LINK_LIBRARIES = "INTERFACE_LINK_LIBRARIES";
|
||||
|
@ -77,29 +77,23 @@ const std::string kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE =
|
|||
const std::map<cm::string_view, TransitiveProperty>
|
||||
cmGeneratorTarget::BuiltinTransitiveProperties = {
|
||||
{ "AUTOMOC_MACRO_NAMES"_s,
|
||||
{ "INTERFACE_AUTOMOC_MACRO_NAMES"_s, LinkInterfaceFor::Compile } },
|
||||
{ "AUTOUIC_OPTIONS"_s,
|
||||
{ "INTERFACE_AUTOUIC_OPTIONS"_s, LinkInterfaceFor::Compile } },
|
||||
{ "INTERFACE_AUTOMOC_MACRO_NAMES"_s, UseTo::Compile } },
|
||||
{ "AUTOUIC_OPTIONS"_s, { "INTERFACE_AUTOUIC_OPTIONS"_s, UseTo::Compile } },
|
||||
{ "COMPILE_DEFINITIONS"_s,
|
||||
{ "INTERFACE_COMPILE_DEFINITIONS"_s, LinkInterfaceFor::Compile } },
|
||||
{ "INTERFACE_COMPILE_DEFINITIONS"_s, UseTo::Compile } },
|
||||
{ "COMPILE_FEATURES"_s,
|
||||
{ "INTERFACE_COMPILE_FEATURES"_s, LinkInterfaceFor::Compile } },
|
||||
{ "COMPILE_OPTIONS"_s,
|
||||
{ "INTERFACE_COMPILE_OPTIONS"_s, LinkInterfaceFor::Compile } },
|
||||
{ "INTERFACE_COMPILE_FEATURES"_s, UseTo::Compile } },
|
||||
{ "COMPILE_OPTIONS"_s, { "INTERFACE_COMPILE_OPTIONS"_s, UseTo::Compile } },
|
||||
{ "INCLUDE_DIRECTORIES"_s,
|
||||
{ "INTERFACE_INCLUDE_DIRECTORIES"_s, LinkInterfaceFor::Compile } },
|
||||
{ "LINK_DEPENDS"_s,
|
||||
{ "INTERFACE_LINK_DEPENDS"_s, LinkInterfaceFor::Link } },
|
||||
{ "LINK_DIRECTORIES"_s,
|
||||
{ "INTERFACE_LINK_DIRECTORIES"_s, LinkInterfaceFor::Link } },
|
||||
{ "LINK_OPTIONS"_s,
|
||||
{ "INTERFACE_LINK_OPTIONS"_s, LinkInterfaceFor::Link } },
|
||||
{ "INTERFACE_INCLUDE_DIRECTORIES"_s, UseTo::Compile } },
|
||||
{ "LINK_DEPENDS"_s, { "INTERFACE_LINK_DEPENDS"_s, UseTo::Link } },
|
||||
{ "LINK_DIRECTORIES"_s, { "INTERFACE_LINK_DIRECTORIES"_s, UseTo::Link } },
|
||||
{ "LINK_OPTIONS"_s, { "INTERFACE_LINK_OPTIONS"_s, UseTo::Link } },
|
||||
{ "PRECOMPILE_HEADERS"_s,
|
||||
{ "INTERFACE_PRECOMPILE_HEADERS"_s, LinkInterfaceFor::Compile } },
|
||||
{ "SOURCES"_s, { "INTERFACE_SOURCES"_s, LinkInterfaceFor::Compile } },
|
||||
{ "INTERFACE_PRECOMPILE_HEADERS"_s, UseTo::Compile } },
|
||||
{ "SOURCES"_s, { "INTERFACE_SOURCES"_s, UseTo::Compile } },
|
||||
{ "SYSTEM_INCLUDE_DIRECTORIES"_s,
|
||||
{ "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"_s,
|
||||
LinkInterfaceFor::Compile } },
|
||||
{ "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"_s, UseTo::Compile } },
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -1401,7 +1395,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
|
|||
}
|
||||
|
||||
cmLinkImplementation const* impl =
|
||||
this->GetLinkImplementation(config, LinkInterfaceFor::Compile);
|
||||
this->GetLinkImplementation(config, UseTo::Compile);
|
||||
if (impl != nullptr) {
|
||||
auto runtimeEntries = impl->LanguageRuntimeLibraries.find(language);
|
||||
if (runtimeEntries != impl->LanguageRuntimeLibraries.end()) {
|
||||
|
@ -1433,7 +1427,7 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
|
|||
|
||||
bool cmGeneratorTarget::MaybeHaveInterfaceProperty(
|
||||
std::string const& prop, cmGeneratorExpressionContext* context,
|
||||
LinkInterfaceFor interfaceFor) const
|
||||
UseTo usage) const
|
||||
{
|
||||
std::string const key = prop + '@' + context->Config;
|
||||
auto i = this->MaybeInterfacePropertyExists.find(key);
|
||||
|
@ -1451,7 +1445,7 @@ bool cmGeneratorTarget::MaybeHaveInterfaceProperty(
|
|||
context->HeadTarget ? context->HeadTarget : this;
|
||||
if (cmLinkInterfaceLibraries const* iface =
|
||||
this->GetLinkInterfaceLibraries(context->Config, headTarget,
|
||||
interfaceFor)) {
|
||||
usage)) {
|
||||
if (iface->HadHeadSensitiveCondition) {
|
||||
// With a different head target we may get to a library with
|
||||
// this interface property.
|
||||
|
@ -1461,8 +1455,7 @@ bool cmGeneratorTarget::MaybeHaveInterfaceProperty(
|
|||
// head target, so we can follow them.
|
||||
for (cmLinkItem const& lib : iface->Libraries) {
|
||||
if (lib.Target &&
|
||||
lib.Target->MaybeHaveInterfaceProperty(prop, context,
|
||||
interfaceFor)) {
|
||||
lib.Target->MaybeHaveInterfaceProperty(prop, context, usage)) {
|
||||
maybeInterfaceProp = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1476,13 +1469,12 @@ bool cmGeneratorTarget::MaybeHaveInterfaceProperty(
|
|||
|
||||
std::string cmGeneratorTarget::EvaluateInterfaceProperty(
|
||||
std::string const& prop, cmGeneratorExpressionContext* context,
|
||||
cmGeneratorExpressionDAGChecker* dagCheckerParent,
|
||||
LinkInterfaceFor interfaceFor) const
|
||||
cmGeneratorExpressionDAGChecker* dagCheckerParent, UseTo usage) const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
// If the property does not appear transitively at all, we are done.
|
||||
if (!this->MaybeHaveInterfaceProperty(prop, context, interfaceFor)) {
|
||||
if (!this->MaybeHaveInterfaceProperty(prop, context, usage)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1514,8 +1506,8 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
|
|||
*p, context->LG, context, headTarget, &dagChecker, this);
|
||||
}
|
||||
|
||||
if (cmLinkInterfaceLibraries const* iface = this->GetLinkInterfaceLibraries(
|
||||
context->Config, headTarget, interfaceFor)) {
|
||||
if (cmLinkInterfaceLibraries const* iface =
|
||||
this->GetLinkInterfaceLibraries(context->Config, headTarget, usage)) {
|
||||
context->HadContextSensitiveCondition =
|
||||
context->HadContextSensitiveCondition ||
|
||||
iface->HadContextSensitiveCondition;
|
||||
|
@ -1533,7 +1525,7 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
|
|||
context->Language);
|
||||
std::string libResult = cmGeneratorExpression::StripEmptyListElements(
|
||||
lib.Target->EvaluateInterfaceProperty(prop, &libContext, &dagChecker,
|
||||
interfaceFor));
|
||||
usage));
|
||||
if (!libResult.empty()) {
|
||||
if (result.empty()) {
|
||||
result = std::move(libResult);
|
||||
|
@ -1568,13 +1560,13 @@ cmGeneratorTarget::IsTransitiveProperty(cm::string_view prop,
|
|||
auto i = BuiltinTransitiveProperties.find(prop);
|
||||
if (i != BuiltinTransitiveProperties.end()) {
|
||||
result = i->second;
|
||||
if (result->InterfaceFor != cmGeneratorTarget::LinkInterfaceFor::Compile) {
|
||||
if (result->Usage != cmGeneratorTarget::UseTo::Compile) {
|
||||
cmPolicies::PolicyStatus cmp0166 =
|
||||
lg->GetPolicyStatus(cmPolicies::CMP0166);
|
||||
if ((cmp0166 == cmPolicies::WARN || cmp0166 == cmPolicies::OLD) &&
|
||||
(prop == "LINK_DIRECTORIES"_s || prop == "LINK_DEPENDS"_s ||
|
||||
prop == "LINK_OPTIONS"_s)) {
|
||||
result->InterfaceFor = cmGeneratorTarget::LinkInterfaceFor::Compile;
|
||||
result->Usage = cmGeneratorTarget::UseTo::Compile;
|
||||
}
|
||||
}
|
||||
} else if (cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_")) {
|
||||
|
@ -1582,7 +1574,7 @@ cmGeneratorTarget::IsTransitiveProperty(cm::string_view prop,
|
|||
lg->GetPolicyStatus(cmPolicies::CMP0043);
|
||||
if (cmp0043 == cmPolicies::WARN || cmp0043 == cmPolicies::OLD) {
|
||||
result = TransitiveProperty{ "INTERFACE_COMPILE_DEFINITIONS"_s,
|
||||
LinkInterfaceFor::Compile };
|
||||
UseTo::Compile };
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1621,8 +1613,8 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
|
|||
}
|
||||
|
||||
std::string directories;
|
||||
if (const auto* link_interface = target->GetLinkInterfaceLibraries(
|
||||
config, root, LinkInterfaceFor::Compile)) {
|
||||
if (const auto* link_interface =
|
||||
target->GetLinkInterfaceLibraries(config, root, UseTo::Compile)) {
|
||||
for (const cmLinkItem& library : link_interface->Libraries) {
|
||||
if (const cmGeneratorTarget* dependency = library.Target) {
|
||||
if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) {
|
||||
|
@ -1653,8 +1645,8 @@ void AddLangSpecificImplicitIncludeDirectories(
|
|||
const std::string& config, const std::string& propertyName,
|
||||
IncludeDirectoryFallBack mode, EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
if (const auto* libraries = target->GetLinkImplementationLibraries(
|
||||
config, LinkInterfaceFor::Compile)) {
|
||||
if (const auto* libraries =
|
||||
target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
||||
cmGeneratorExpressionDAGChecker dag{
|
||||
target->GetBacktrace(), target, propertyName, nullptr, nullptr,
|
||||
target->GetLocalGenerator()
|
||||
|
@ -1697,8 +1689,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
|||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(
|
||||
config, LinkInterfaceFor::Compile)) {
|
||||
headTarget->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
||||
entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
if (lib.Target &&
|
||||
|
@ -1924,7 +1915,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
|||
EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
|
||||
AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
|
||||
&dagChecker, linkInterfaceSourcesEntries,
|
||||
IncludeRuntimeInterface::No, LinkInterfaceFor::Compile);
|
||||
IncludeRuntimeInterface::No, UseTo::Compile);
|
||||
bool contextDependentInterfaceSources = processSources(
|
||||
this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
|
||||
|
||||
|
@ -2887,7 +2878,7 @@ bool cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
|
|||
// Get languages built in this target.
|
||||
std::unordered_set<std::string> languages;
|
||||
cmLinkImplementation const* impl =
|
||||
this->GetLinkImplementation(config, LinkInterfaceFor::Link, secondPass);
|
||||
this->GetLinkImplementation(config, UseTo::Link, secondPass);
|
||||
assert(impl);
|
||||
languages.insert(impl->Languages.cbegin(), impl->Languages.cend());
|
||||
|
||||
|
@ -3141,7 +3132,7 @@ static void processILibs(const std::string& config,
|
|||
tgts.push_back(item.Target);
|
||||
if (cmLinkInterfaceLibraries const* iface =
|
||||
item.Target->GetLinkInterfaceLibraries(config, headTarget,
|
||||
LinkInterfaceFor::Compile)) {
|
||||
UseTo::Compile)) {
|
||||
for (cmLinkItem const& lib : iface->Libraries) {
|
||||
processILibs(config, headTarget, lib, gg, tgts, emitted);
|
||||
}
|
||||
|
@ -3165,7 +3156,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(
|
|||
std::set<cmGeneratorTarget const*> emitted;
|
||||
|
||||
cmLinkImplementationLibraries const* impl =
|
||||
this->GetLinkImplementationLibraries(config, LinkInterfaceFor::Compile);
|
||||
this->GetLinkImplementationLibraries(config, UseTo::Compile);
|
||||
assert(impl);
|
||||
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
|
@ -3973,8 +3964,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
|||
|
||||
if (this->IsApple()) {
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
this->GetLinkImplementationLibraries(config,
|
||||
LinkInterfaceFor::Compile)) {
|
||||
this->GetLinkImplementationLibraries(config, UseTo::Compile)) {
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
std::string libDir;
|
||||
if (lib.Target == nullptr) {
|
||||
|
@ -4765,8 +4755,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
|
|||
AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? LinkInterfaceFor::Link
|
||||
: LinkInterfaceFor::Compile);
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, debugOptions,
|
||||
"link options", OptionsParse::Shell, this->IsDeviceLink());
|
||||
|
@ -5047,8 +5037,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
|
|||
AddInterfaceEntries(this, config, "INTERFACE_LINK_DIRECTORIES", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? LinkInterfaceFor::Link
|
||||
: LinkInterfaceFor::Compile);
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
processLinkDirectories(this, entries, result, uniqueDirectories,
|
||||
debugDirectories);
|
||||
|
@ -5089,8 +5079,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
|
|||
AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? LinkInterfaceFor::Link
|
||||
: LinkInterfaceFor::Compile);
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, false, "link depends",
|
||||
OptionsParse::None);
|
||||
|
@ -6649,7 +6639,7 @@ void cmGeneratorTarget::CheckLinkLibraries() const
|
|||
std::vector<std::string> const& configs =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& config : configs) {
|
||||
this->GetLinkInterfaceLibraries(config, this, LinkInterfaceFor::Link);
|
||||
this->GetLinkInterfaceLibraries(config, this, UseTo::Link);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7051,10 +7041,12 @@ cm::optional<cmLinkItem> cmGeneratorTarget::LookupLinkItem(
|
|||
return maybeItem;
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::ExpandLinkItems(
|
||||
std::string const& prop, cmBTStringRange entries, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget, LinkInterfaceFor interfaceFor,
|
||||
LinkInterfaceField field, cmLinkInterface& iface) const
|
||||
void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
|
||||
cmBTStringRange entries,
|
||||
std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
UseTo usage, LinkInterfaceField field,
|
||||
cmLinkInterface& iface) const
|
||||
{
|
||||
if (entries.empty()) {
|
||||
return;
|
||||
|
@ -7065,7 +7057,7 @@ void cmGeneratorTarget::ExpandLinkItems(
|
|||
// The $<LINK_ONLY> expression may be in a link interface to specify
|
||||
// private link dependencies that are otherwise excluded from usage
|
||||
// requirements.
|
||||
if (interfaceFor == LinkInterfaceFor::Compile) {
|
||||
if (usage == UseTo::Compile) {
|
||||
dagChecker.SetTransitivePropertiesOnly();
|
||||
dagChecker.SetTransitivePropertiesOnlyCMP0131();
|
||||
}
|
||||
|
@ -7142,8 +7134,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
|
|||
{
|
||||
// Imported targets have their own link interface.
|
||||
if (this->IsImported()) {
|
||||
return this->GetImportLinkInterface(config, head, LinkInterfaceFor::Link,
|
||||
secondPass);
|
||||
return this->GetImportLinkInterface(config, head, UseTo::Link, secondPass);
|
||||
}
|
||||
|
||||
// Link interfaces are not supported for executables that do not
|
||||
|
@ -7168,8 +7159,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
|
|||
}
|
||||
if (!iface.LibrariesDone) {
|
||||
iface.LibrariesDone = true;
|
||||
this->ComputeLinkInterfaceLibraries(config, iface, head,
|
||||
LinkInterfaceFor::Link);
|
||||
this->ComputeLinkInterfaceLibraries(config, iface, head, UseTo::Link);
|
||||
}
|
||||
if (!iface.AllDone) {
|
||||
iface.AllDone = true;
|
||||
|
@ -7204,8 +7194,8 @@ void cmGeneratorTarget::ComputeLinkInterface(
|
|||
emitted.insert(lib);
|
||||
}
|
||||
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
cmLinkImplementation const* impl = this->GetLinkImplementation(
|
||||
config, LinkInterfaceFor::Link, secondPass);
|
||||
cmLinkImplementation const* impl =
|
||||
this->GetLinkImplementation(config, UseTo::Link, secondPass);
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
if (emitted.insert(lib).second) {
|
||||
if (lib.Target) {
|
||||
|
@ -7228,15 +7218,15 @@ void cmGeneratorTarget::ComputeLinkInterface(
|
|||
// The link implementation is the default link interface.
|
||||
cmLinkImplementationLibraries const* impl =
|
||||
this->GetLinkImplementationLibrariesInternal(config, headTarget,
|
||||
LinkInterfaceFor::Link);
|
||||
UseTo::Link);
|
||||
iface.ImplementationIsInterface = true;
|
||||
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
|
||||
}
|
||||
|
||||
if (this->LinkLanguagePropagatesToDependents()) {
|
||||
// Targets using this archive need its language runtime libraries.
|
||||
if (cmLinkImplementation const* impl = this->GetLinkImplementation(
|
||||
config, LinkInterfaceFor::Link, secondPass)) {
|
||||
if (cmLinkImplementation const* impl =
|
||||
this->GetLinkImplementation(config, UseTo::Link, secondPass)) {
|
||||
iface.Languages = impl->Languages;
|
||||
}
|
||||
}
|
||||
|
@ -7263,12 +7253,11 @@ void cmGeneratorTarget::ComputeLinkInterface(
|
|||
}
|
||||
|
||||
const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
|
||||
const std::string& config, cmGeneratorTarget const* head,
|
||||
LinkInterfaceFor interfaceFor) const
|
||||
const std::string& config, cmGeneratorTarget const* head, UseTo usage) const
|
||||
{
|
||||
// Imported targets have their own link interface.
|
||||
if (this->IsImported()) {
|
||||
return this->GetImportLinkInterface(config, head, interfaceFor);
|
||||
return this->GetImportLinkInterface(config, head, usage);
|
||||
}
|
||||
|
||||
// Link interfaces are not supported for executables that do not
|
||||
|
@ -7280,7 +7269,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
|
|||
|
||||
// Lookup any existing link interface for this configuration.
|
||||
cmHeadToLinkInterfaceMap& hm =
|
||||
(interfaceFor == LinkInterfaceFor::Compile
|
||||
(usage == UseTo::Compile
|
||||
? this->GetHeadToLinkInterfaceUsageRequirementsMap(config)
|
||||
: this->GetHeadToLinkInterfaceMap(config));
|
||||
|
||||
|
@ -7293,7 +7282,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
|
|||
cmOptionalLinkInterface& iface = hm[head];
|
||||
if (!iface.LibrariesDone) {
|
||||
iface.LibrariesDone = true;
|
||||
this->ComputeLinkInterfaceLibraries(config, iface, head, interfaceFor);
|
||||
this->ComputeLinkInterfaceLibraries(config, iface, head, usage);
|
||||
}
|
||||
|
||||
return iface.Exists ? &iface : nullptr;
|
||||
|
@ -7556,7 +7545,7 @@ bool cmGeneratorTarget::GetRPATH(const std::string& config,
|
|||
|
||||
void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
||||
const std::string& config, cmOptionalLinkInterface& iface,
|
||||
cmGeneratorTarget const* headTarget, LinkInterfaceFor interfaceFor) const
|
||||
cmGeneratorTarget const* headTarget, UseTo usage) const
|
||||
{
|
||||
// Construct the property name suffix for this configuration.
|
||||
std::string suffix = "_";
|
||||
|
@ -7644,21 +7633,21 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
|||
// Use its special representation directly to get backtraces.
|
||||
this->ExpandLinkItems(
|
||||
kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(),
|
||||
config, headTarget, interfaceFor, LinkInterfaceField::Libraries, iface);
|
||||
config, headTarget, usage, LinkInterfaceField::Libraries, iface);
|
||||
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT,
|
||||
this->Target->GetLinkInterfaceDirectEntries(),
|
||||
config, headTarget, interfaceFor,
|
||||
config, headTarget, usage,
|
||||
LinkInterfaceField::HeadInclude, iface);
|
||||
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
|
||||
this->Target->GetLinkInterfaceDirectExcludeEntries(),
|
||||
config, headTarget, interfaceFor,
|
||||
config, headTarget, usage,
|
||||
LinkInterfaceField::HeadExclude, iface);
|
||||
} else if (explicitLibrariesCMP0022OLD) {
|
||||
// The interface libraries have been explicitly set in pre-CMP0022 style.
|
||||
std::vector<BT<std::string>> entries;
|
||||
entries.emplace_back(*explicitLibrariesCMP0022OLD);
|
||||
this->ExpandLinkItems(linkIfacePropCMP0022OLD, cmMakeRange(entries),
|
||||
config, headTarget, interfaceFor,
|
||||
config, headTarget, usage,
|
||||
LinkInterfaceField::Libraries, iface);
|
||||
}
|
||||
|
||||
|
@ -7670,18 +7659,17 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
|
|||
// The link implementation is the default link interface.
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
this->GetLinkImplementationLibrariesInternal(config, headTarget,
|
||||
interfaceFor)) {
|
||||
usage)) {
|
||||
iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(),
|
||||
impl->Libraries.end());
|
||||
if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
|
||||
!this->PolicyWarnedCMP0022 && interfaceFor == LinkInterfaceFor::Link) {
|
||||
!this->PolicyWarnedCMP0022 && usage == UseTo::Link) {
|
||||
// Compare the link implementation fallback link interface to the
|
||||
// preferred new link interface property and warn if different.
|
||||
cmLinkInterface ifaceNew;
|
||||
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES,
|
||||
this->Target->GetLinkInterfaceEntries(), config,
|
||||
headTarget, interfaceFor,
|
||||
LinkInterfaceField::Libraries, ifaceNew);
|
||||
this->ExpandLinkItems(
|
||||
kINTERFACE_LINK_LIBRARIES, this->Target->GetLinkInterfaceEntries(),
|
||||
config, headTarget, usage, LinkInterfaceField::Libraries, ifaceNew);
|
||||
if (ifaceNew.Libraries != iface.Libraries) {
|
||||
std::string oldLibraries = cmJoin(impl->Libraries, ";");
|
||||
std::string newLibraries = cmJoin(ifaceNew.Libraries, ";");
|
||||
|
@ -7793,8 +7781,8 @@ void cmGeneratorTarget::ComputeLinkImplementationRuntimeLibraries(
|
|||
}
|
||||
|
||||
const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
|
||||
const std::string& config, cmGeneratorTarget const* headTarget,
|
||||
LinkInterfaceFor interfaceFor, bool secondPass) const
|
||||
const std::string& config, cmGeneratorTarget const* headTarget, UseTo usage,
|
||||
bool secondPass) const
|
||||
{
|
||||
cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config);
|
||||
if (!info) {
|
||||
|
@ -7802,7 +7790,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
|
|||
}
|
||||
|
||||
cmHeadToLinkInterfaceMap& hm =
|
||||
(interfaceFor == LinkInterfaceFor::Compile
|
||||
(usage == UseTo::Compile
|
||||
? this->GetHeadToLinkInterfaceUsageRequirementsMap(config)
|
||||
: this->GetHeadToLinkInterfaceMap(config));
|
||||
|
||||
|
@ -7823,14 +7811,14 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
|
|||
cmExpandList(info->Languages, iface.Languages);
|
||||
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT,
|
||||
cmMakeRange(info->LibrariesHeadInclude), config,
|
||||
headTarget, interfaceFor,
|
||||
LinkInterfaceField::HeadInclude, iface);
|
||||
headTarget, usage, LinkInterfaceField::HeadInclude,
|
||||
iface);
|
||||
this->ExpandLinkItems(kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
|
||||
cmMakeRange(info->LibrariesHeadExclude), config,
|
||||
headTarget, interfaceFor,
|
||||
LinkInterfaceField::HeadExclude, iface);
|
||||
headTarget, usage, LinkInterfaceField::HeadExclude,
|
||||
iface);
|
||||
this->ExpandLinkItems(info->LibrariesProp, cmMakeRange(info->Libraries),
|
||||
config, headTarget, interfaceFor,
|
||||
config, headTarget, usage,
|
||||
LinkInterfaceField::Libraries, iface);
|
||||
cmList deps{ info->SharedDeps };
|
||||
LookupLinkItemScope scope{ this->LocalGenerator };
|
||||
|
@ -8056,13 +8044,13 @@ cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap(
|
|||
}
|
||||
|
||||
const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
|
||||
const std::string& config, LinkInterfaceFor implFor) const
|
||||
const std::string& config, UseTo usage) const
|
||||
{
|
||||
return this->GetLinkImplementation(config, implFor, false);
|
||||
return this->GetLinkImplementation(config, usage, false);
|
||||
}
|
||||
|
||||
const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
|
||||
const std::string& config, LinkInterfaceFor implFor, bool secondPass) const
|
||||
const std::string& config, UseTo usage, bool secondPass) const
|
||||
{
|
||||
// There is no link implementation for targets that cannot compile sources.
|
||||
if (!this->CanCompileSources()) {
|
||||
|
@ -8070,7 +8058,7 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
|
|||
}
|
||||
|
||||
HeadToLinkImplementationMap& hm =
|
||||
(implFor == LinkInterfaceFor::Compile
|
||||
(usage == UseTo::Compile
|
||||
? this->GetHeadToLinkImplementationUsageRequirementsMap(config)
|
||||
: this->GetHeadToLinkImplementationMap(config));
|
||||
cmOptionalLinkImplementation& impl = hm[this];
|
||||
|
@ -8079,7 +8067,7 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
|
|||
}
|
||||
if (!impl.LibrariesDone) {
|
||||
impl.LibrariesDone = true;
|
||||
this->ComputeLinkImplementationLibraries(config, impl, this, implFor);
|
||||
this->ComputeLinkImplementationLibraries(config, impl, this, usage);
|
||||
}
|
||||
if (!impl.LanguagesDone) {
|
||||
impl.LanguagesDone = true;
|
||||
|
@ -8347,23 +8335,22 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
|
|||
return true;
|
||||
}
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
this->GetLinkImplementationLibraries(config, LinkInterfaceFor::Link)) {
|
||||
this->GetLinkImplementationLibraries(config, UseTo::Link)) {
|
||||
return !impl->Libraries.empty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cmLinkImplementationLibraries const*
|
||||
cmGeneratorTarget::GetLinkImplementationLibraries(
|
||||
const std::string& config, LinkInterfaceFor implFor) const
|
||||
cmGeneratorTarget::GetLinkImplementationLibraries(const std::string& config,
|
||||
UseTo usage) const
|
||||
{
|
||||
return this->GetLinkImplementationLibrariesInternal(config, this, implFor);
|
||||
return this->GetLinkImplementationLibrariesInternal(config, this, usage);
|
||||
}
|
||||
|
||||
cmLinkImplementationLibraries const*
|
||||
cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
|
||||
const std::string& config, cmGeneratorTarget const* head,
|
||||
LinkInterfaceFor implFor) const
|
||||
const std::string& config, cmGeneratorTarget const* head, UseTo usage) const
|
||||
{
|
||||
// There is no link implementation for targets that cannot compile sources.
|
||||
if (!this->CanCompileSources()) {
|
||||
|
@ -8372,7 +8359,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
|
|||
|
||||
// Populate the link implementation libraries for this configuration.
|
||||
HeadToLinkImplementationMap& hm =
|
||||
(implFor == LinkInterfaceFor::Compile
|
||||
(usage == UseTo::Compile
|
||||
? this->GetHeadToLinkImplementationUsageRequirementsMap(config)
|
||||
: this->GetHeadToLinkImplementationMap(config));
|
||||
|
||||
|
@ -8385,7 +8372,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
|
|||
cmOptionalLinkImplementation& impl = hm[head];
|
||||
if (!impl.LibrariesDone) {
|
||||
impl.LibrariesDone = true;
|
||||
this->ComputeLinkImplementationLibraries(config, impl, head, implFor);
|
||||
this->ComputeLinkImplementationLibraries(config, impl, head, usage);
|
||||
}
|
||||
return &impl;
|
||||
}
|
||||
|
@ -8401,7 +8388,7 @@ class TransitiveLinkImpl
|
|||
{
|
||||
cmGeneratorTarget const* Self;
|
||||
std::string const& Config;
|
||||
LinkInterfaceFor ImplFor;
|
||||
UseTo ImplFor;
|
||||
cmLinkImplementation& Impl;
|
||||
|
||||
std::set<cmLinkItem> Emitted;
|
||||
|
@ -8412,10 +8399,10 @@ class TransitiveLinkImpl
|
|||
|
||||
public:
|
||||
TransitiveLinkImpl(cmGeneratorTarget const* self, std::string const& config,
|
||||
LinkInterfaceFor implFor, cmLinkImplementation& impl)
|
||||
UseTo usage, cmLinkImplementation& impl)
|
||||
: Self(self)
|
||||
, Config(config)
|
||||
, ImplFor(implFor)
|
||||
, ImplFor(usage)
|
||||
, Impl(impl)
|
||||
{
|
||||
}
|
||||
|
@ -8496,11 +8483,10 @@ void TransitiveLinkImpl::Compute()
|
|||
}
|
||||
|
||||
void ComputeLinkImplTransitive(cmGeneratorTarget const* self,
|
||||
std::string const& config,
|
||||
LinkInterfaceFor implFor,
|
||||
std::string const& config, UseTo usage,
|
||||
cmLinkImplementation& impl)
|
||||
{
|
||||
TransitiveLinkImpl transitiveLinkImpl(self, config, implFor, impl);
|
||||
TransitiveLinkImpl transitiveLinkImpl(self, config, usage, impl);
|
||||
transitiveLinkImpl.Compute();
|
||||
}
|
||||
}
|
||||
|
@ -8626,8 +8612,7 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
|
|||
std::vector<std::string> allConfigs =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
cmOptionalLinkImplementation impl;
|
||||
this->ComputeLinkImplementationLibraries(config, impl, this,
|
||||
LinkInterfaceFor::Link);
|
||||
this->ComputeLinkImplementationLibraries(config, impl, this, UseTo::Link);
|
||||
|
||||
cmCxxModuleUsageEffects usage(this);
|
||||
|
||||
|
@ -8733,7 +8718,7 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
|
|||
|
||||
void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
const std::string& config, cmOptionalLinkImplementation& impl,
|
||||
cmGeneratorTarget const* head, LinkInterfaceFor implFor) const
|
||||
cmGeneratorTarget const* head, UseTo usage) const
|
||||
{
|
||||
cmLocalGenerator const* lg = this->LocalGenerator;
|
||||
cmMakefile const* mf = lg->GetMakefile();
|
||||
|
@ -8746,7 +8731,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
|||
nullptr, this->LocalGenerator);
|
||||
// The $<LINK_ONLY> expression may be used to specify link dependencies
|
||||
// that are otherwise excluded from usage requirements.
|
||||
if (implFor == LinkInterfaceFor::Compile) {
|
||||
if (usage == UseTo::Compile) {
|
||||
dagChecker.SetTransitivePropertiesOnly();
|
||||
switch (this->GetPolicyStatusCMP0131()) {
|
||||
case cmPolicies::WARN:
|
||||
|
@ -8870,7 +8855,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
|||
|
||||
// Update the list of direct link dependencies from usage requirements.
|
||||
if (head == this) {
|
||||
ComputeLinkImplTransitive(this, config, implFor, impl);
|
||||
ComputeLinkImplTransitive(this, config, usage, impl);
|
||||
}
|
||||
|
||||
// Get the list of configurations considered to be DEBUG.
|
||||
|
|
|
@ -258,7 +258,7 @@ public:
|
|||
cmOptionalLinkInterface& iface,
|
||||
const cmGeneratorTarget* head) const;
|
||||
|
||||
enum class LinkInterfaceFor
|
||||
enum class UseTo
|
||||
{
|
||||
Compile, // Usage requirements for compiling. Excludes $<LINK_ONLY>.
|
||||
Link, // Usage requirements for linking. Includes $<LINK_ONLY>.
|
||||
|
@ -266,12 +266,12 @@ public:
|
|||
|
||||
cmLinkInterfaceLibraries const* GetLinkInterfaceLibraries(
|
||||
const std::string& config, const cmGeneratorTarget* headTarget,
|
||||
LinkInterfaceFor interfaceFor) const;
|
||||
UseTo usage) const;
|
||||
|
||||
void ComputeLinkInterfaceLibraries(const std::string& config,
|
||||
cmOptionalLinkInterface& iface,
|
||||
const cmGeneratorTarget* head,
|
||||
LinkInterfaceFor interfaceFor) const;
|
||||
UseTo usage) const;
|
||||
|
||||
/** Get the library name for an imported interface library. */
|
||||
std::string GetImportedLibName(std::string const& config) const;
|
||||
|
@ -429,19 +429,19 @@ public:
|
|||
|
||||
LinkClosure const* GetLinkClosure(const std::string& config) const;
|
||||
|
||||
cmLinkImplementation const* GetLinkImplementation(
|
||||
const std::string& config, LinkInterfaceFor implFor) const;
|
||||
cmLinkImplementation const* GetLinkImplementation(const std::string& config,
|
||||
UseTo usage) const;
|
||||
|
||||
void ComputeLinkImplementationLanguages(
|
||||
const std::string& config, cmOptionalLinkImplementation& impl) const;
|
||||
|
||||
cmLinkImplementationLibraries const* GetLinkImplementationLibraries(
|
||||
const std::string& config, LinkInterfaceFor implFor) const;
|
||||
const std::string& config, UseTo usage) const;
|
||||
|
||||
void ComputeLinkImplementationLibraries(const std::string& config,
|
||||
cmOptionalLinkImplementation& impl,
|
||||
const cmGeneratorTarget* head,
|
||||
LinkInterfaceFor implFor) const;
|
||||
UseTo usage) const;
|
||||
|
||||
struct TargetOrString
|
||||
{
|
||||
|
@ -886,13 +886,12 @@ public:
|
|||
|
||||
std::string EvaluateInterfaceProperty(
|
||||
std::string const& prop, cmGeneratorExpressionContext* context,
|
||||
cmGeneratorExpressionDAGChecker* dagCheckerParent,
|
||||
LinkInterfaceFor interfaceFor) const;
|
||||
cmGeneratorExpressionDAGChecker* dagCheckerParent, UseTo usage) const;
|
||||
|
||||
struct TransitiveProperty
|
||||
{
|
||||
cm::string_view InterfaceName;
|
||||
LinkInterfaceFor InterfaceFor;
|
||||
UseTo Usage;
|
||||
};
|
||||
|
||||
static const std::map<cm::string_view, TransitiveProperty>
|
||||
|
@ -1102,7 +1101,7 @@ private:
|
|||
const cmGeneratorTarget* head,
|
||||
bool secondPass) const;
|
||||
cmLinkImplementation const* GetLinkImplementation(const std::string& config,
|
||||
LinkInterfaceFor implFor,
|
||||
UseTo usage,
|
||||
bool secondPass) const;
|
||||
|
||||
enum class LinkItemRole
|
||||
|
@ -1143,7 +1142,7 @@ private:
|
|||
|
||||
cmLinkInterface const* GetImportLinkInterface(const std::string& config,
|
||||
const cmGeneratorTarget* head,
|
||||
LinkInterfaceFor interfaceFor,
|
||||
UseTo usage,
|
||||
bool secondPass = false) const;
|
||||
|
||||
using KindedSourcesMapType = std::map<std::string, KindedSources>;
|
||||
|
@ -1157,7 +1156,7 @@ private:
|
|||
mutable std::unordered_map<std::string, bool> MaybeInterfacePropertyExists;
|
||||
bool MaybeHaveInterfaceProperty(std::string const& prop,
|
||||
cmGeneratorExpressionContext* context,
|
||||
LinkInterfaceFor interfaceFor) const;
|
||||
UseTo usage) const;
|
||||
|
||||
using TargetPropertyEntryVector =
|
||||
std::vector<std::unique_ptr<TargetPropertyEntry>>;
|
||||
|
@ -1193,9 +1192,8 @@ private:
|
|||
};
|
||||
void ExpandLinkItems(std::string const& prop, cmBTStringRange entries,
|
||||
std::string const& config,
|
||||
const cmGeneratorTarget* headTarget,
|
||||
LinkInterfaceFor interfaceFor, LinkInterfaceField field,
|
||||
cmLinkInterface& iface) const;
|
||||
const cmGeneratorTarget* headTarget, UseTo usage,
|
||||
LinkInterfaceField field, cmLinkInterface& iface) const;
|
||||
|
||||
struct LookupLinkItemScope
|
||||
{
|
||||
|
@ -1234,7 +1232,7 @@ private:
|
|||
|
||||
cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
|
||||
const std::string& config, const cmGeneratorTarget* head,
|
||||
LinkInterfaceFor implFor) const;
|
||||
UseTo usage) const;
|
||||
bool ComputeOutputDir(const std::string& config,
|
||||
cmStateEnums::ArtifactType artifact,
|
||||
std::string& out) const;
|
||||
|
|
|
@ -1666,9 +1666,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
|
|||
|
||||
// If the language is compiled as a source trust Xcode to link with it.
|
||||
for (auto const& Language :
|
||||
gtgt
|
||||
->GetLinkImplementation("NOCONFIG",
|
||||
cmGeneratorTarget::LinkInterfaceFor::Link)
|
||||
gtgt->GetLinkImplementation("NOCONFIG", cmGeneratorTarget::UseTo::Link)
|
||||
->Languages) {
|
||||
if (Language == llang) {
|
||||
return;
|
||||
|
|
|
@ -99,7 +99,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
|
|||
DependencyMap& dependencies)
|
||||
{
|
||||
const auto* implementationLibraries = target.GetLinkImplementationLibraries(
|
||||
config, cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
config, cmGeneratorTarget::UseTo::Link);
|
||||
if (implementationLibraries != nullptr) {
|
||||
for (auto const& lib : implementationLibraries->Libraries) {
|
||||
auto const& name = lib.AsStr();
|
||||
|
@ -108,7 +108,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
|
|||
}
|
||||
|
||||
const auto* interfaceLibraries = target.GetLinkInterfaceLibraries(
|
||||
config, &target, cmGeneratorTarget::LinkInterfaceFor::Compile);
|
||||
config, &target, cmGeneratorTarget::UseTo::Compile);
|
||||
if (interfaceLibraries != nullptr) {
|
||||
for (auto const& lib : interfaceLibraries->Libraries) {
|
||||
auto const& name = lib.AsStr();
|
||||
|
|
|
@ -156,8 +156,8 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
|
|||
linkLib.Value += " ";
|
||||
|
||||
const cmLinkImplementation* linkImpl =
|
||||
cli.GetTarget()->GetLinkImplementation(
|
||||
cli.GetConfig(), cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
cli.GetTarget()->GetLinkImplementation(cli.GetConfig(),
|
||||
cmGeneratorTarget::UseTo::Link);
|
||||
|
||||
for (const cmLinkImplItem& iter : linkImpl->Libraries) {
|
||||
if (iter.Target != nullptr &&
|
||||
|
|
|
@ -122,7 +122,7 @@ bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
|
|||
// Collect all static_library dependencies from the test target
|
||||
cmLinkImplementationLibraries const* libs =
|
||||
testTarget->GetLinkImplementationLibraries(
|
||||
config, cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
config, cmGeneratorTarget::UseTo::Link);
|
||||
if (libs) {
|
||||
for (cmLinkItem const& item : libs->Libraries) {
|
||||
cmGeneratorTarget const* depTarget = item.Target;
|
||||
|
@ -1461,7 +1461,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
|||
for (std::string const& config : this->ConfigsList) {
|
||||
cmLinkImplementationLibraries const* libs =
|
||||
this->GenTarget->GetLinkImplementationLibraries(
|
||||
config, cmGeneratorTarget::LinkInterfaceFor::Link);
|
||||
config, cmGeneratorTarget::UseTo::Link);
|
||||
if (libs) {
|
||||
for (cmLinkItem const& item : libs->Libraries) {
|
||||
cmGeneratorTarget const* libTarget = item.Target;
|
||||
|
|
Loading…
Reference in New Issue