Genex: Do not consider 'head' when evaluating build properties
When $<TARGET_PROPERTY> names a build property like COMPILE_DEFINITIONS but not the usage requirement (INTERFACE_) version of it, the value should be that used to build the target. It should not be influenced by a dependent 'head' target like usage requirements are. Extend the CompileDefinitions test with a case covering the corrected behavior. Reviewed-by: Stephen Kelly <steveire@gmail.com>
This commit is contained in:
parent
ebd8fa2256
commit
3f476beaf7
|
@ -1081,7 +1081,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef POPULATE_INTERFACE_PROPERTY_NAME
|
#undef POPULATE_INTERFACE_PROPERTY_NAME
|
||||||
cmTarget const* headTarget = context->HeadTarget
|
cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty
|
||||||
? context->HeadTarget : target;
|
? context->HeadTarget : target;
|
||||||
|
|
||||||
if(isInterfaceProperty)
|
if(isInterfaceProperty)
|
||||||
|
@ -1103,7 +1103,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
{
|
{
|
||||||
linkedTargetsContent =
|
linkedTargetsContent =
|
||||||
getLinkedTargetsContent(impl->Libraries, target,
|
getLinkedTargetsContent(impl->Libraries, target,
|
||||||
headTarget,
|
target,
|
||||||
context, &dagChecker,
|
context, &dagChecker,
|
||||||
interfacePropertyName);
|
interfacePropertyName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,3 +53,8 @@ set_property(TARGET target_prop_mixed_executable APPEND PROPERTY COMPILE_DEFINIT
|
||||||
"LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
|
"LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
|
||||||
"C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>"
|
"C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_library(tgt STATIC IMPORTED)
|
||||||
|
set_property(TARGET tgt APPEND PROPERTY COMPILE_DEFINITIONS TGT_DEF TGT_TYPE_$<TARGET_PROPERTY:TYPE>)
|
||||||
|
add_executable(usetgt usetgt.c)
|
||||||
|
target_compile_definitions(usetgt PRIVATE $<TARGET_PROPERTY:tgt,COMPILE_DEFINITIONS>)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef TGT_DEF
|
||||||
|
# error TGT_DEF incorrectly not defined
|
||||||
|
#endif
|
||||||
|
#ifndef TGT_TYPE_STATIC_LIBRARY
|
||||||
|
# error TGT_TYPE_STATIC_LIBRARY incorrectly not defined
|
||||||
|
#endif
|
||||||
|
#ifdef TGT_TYPE_EXECUTABLE
|
||||||
|
# error TGT_TYPE_EXECUTABLE incorrectly defined
|
||||||
|
#endif
|
||||||
|
int main(void) { return 0; }
|
Loading…
Reference in New Issue