mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
GenEx: Add support for custom transitive compile properties
Teach the `$<TARGET_PROPERTY:...>` generator expression to check for a new `TRANSITIVE_COMPILE_PROPERTIES` property in the target's link closure to enable transitive evaluation of named properties through the link closure, excluding entries guarded by `$<LINK_ONLY:...>`. Issue: #20416
This commit is contained in:
@@ -2873,19 +2873,22 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||
return target->GetLinkerLanguage(context->Config);
|
||||
}
|
||||
|
||||
bool const evaluatingLinkLibraries =
|
||||
dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries();
|
||||
|
||||
std::string interfacePropertyName;
|
||||
bool isInterfaceProperty = false;
|
||||
cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile;
|
||||
|
||||
if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
|
||||
target->IsTransitiveProperty(propertyName, context->LG)) {
|
||||
target->IsTransitiveProperty(propertyName, context->LG,
|
||||
context->Config,
|
||||
evaluatingLinkLibraries)) {
|
||||
interfacePropertyName = std::string(transitiveProp->InterfaceName);
|
||||
isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
|
||||
usage = transitiveProp->Usage;
|
||||
}
|
||||
|
||||
bool evaluatingLinkLibraries = false;
|
||||
|
||||
if (dagCheckerParent) {
|
||||
// This $<TARGET_PROPERTY:...> node has been reached while evaluating
|
||||
// another target property value. Check that the outermost evaluation
|
||||
@@ -2894,8 +2897,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||
dagCheckerParent->EvaluatingPICExpression() ||
|
||||
dagCheckerParent->EvaluatingLinkerLauncher()) {
|
||||
// No check required.
|
||||
} else if (dagCheckerParent->EvaluatingLinkLibraries()) {
|
||||
evaluatingLinkLibraries = true;
|
||||
} else if (evaluatingLinkLibraries) {
|
||||
if (!interfacePropertyName.empty()) {
|
||||
reportError(
|
||||
context, content->GetOriginalExpression(),
|
||||
|
||||
Reference in New Issue
Block a user