From f4249cf86f6478e4e87b575063c88974bb600d31 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 16:42:46 -0400 Subject: Tests: Add COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} transitive-only cases --- Tests/CompatibleInterface/CMakeLists.txt | 10 ++++++++-- Tests/CompatibleInterface/main.cpp | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 668a97b..0d5423a 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -26,18 +26,20 @@ set_property(TARGET iface1 APPEND PROPERTY NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 + NUMBER_MIN_PROP5 ) set_property(TARGET iface1 APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 + NUMBER_MAX_PROP3 ) set(CMAKE_DEBUG_TARGET_PROPERTIES BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 STRING_PROP1 STRING_PROP2 STRING_PROP3 - NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 - NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 + NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 NUMBER_MIN_PROP5 + NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 NUMBER_MAX_PROP3 ) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) @@ -48,8 +50,10 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP3 0x10) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP4 0x10) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP5 5) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP3 3) add_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) @@ -86,8 +90,10 @@ target_compile_definitions(CompatibleInterface $<$,200>:NUMBER_MIN_PROP2=200> $<$,0xA>:NUMBER_MIN_PROP3=0xA> $<$,0x10>:NUMBER_MIN_PROP4=0x10> + $<$,5>:NUMBER_MIN_PROP5=5> $<$,100>:NUMBER_MAX_PROP1=100> $<$,250>:NUMBER_MAX_PROP2=250> + $<$,3>:NUMBER_MAX_PROP3=3> ) diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index 0bccb82..b540888 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -35,10 +35,12 @@ enum { NumericMaxTest1 = sizeof(CMakeStaticAssert), NumericMaxTest2 = sizeof(CMakeStaticAssert), + NumericMaxTest3 = sizeof(CMakeStaticAssert), NumericMinTest1 = sizeof(CMakeStaticAssert), NumericMinTest2 = sizeof(CMakeStaticAssert), NumericMinTest3 = sizeof(CMakeStaticAssert), - NumericMinTest4 = sizeof(CMakeStaticAssert) + NumericMinTest4 = sizeof(CMakeStaticAssert), + NumericMinTest5 = sizeof(CMakeStaticAssert) }; #include "iface2.h" -- cgit v0.12 From 5ebcf961702e723b69e777f4286bca357d2b5fad Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 10:04:24 -0400 Subject: Tests: Add COMPATIBLE_INTERFACE_ cases for library targets The transitive (or not) behavior of these properties depends on the target type. Add cases for STATIC, OBJECT, and INTERFACE libraries. --- Tests/CompatibleInterface/CMakeLists.txt | 75 +++++++++++++++++++++++-- Tests/CompatibleInterface/main.cpp | 96 ++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 4 deletions(-) diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 0d5423a..da15ae9 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -13,12 +13,14 @@ set_property(TARGET iface1 APPEND PROPERTY BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 + BOOL_PROP5 ) set_property(TARGET iface1 APPEND PROPERTY COMPATIBLE_INTERFACE_STRING STRING_PROP1 STRING_PROP2 STRING_PROP3 + STRING_PROP4 ) set_property(TARGET iface1 APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN @@ -27,33 +29,39 @@ set_property(TARGET iface1 APPEND PROPERTY NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 NUMBER_MIN_PROP5 + NUMBER_MIN_PROP6 ) set_property(TARGET iface1 APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 NUMBER_MAX_PROP3 + NUMBER_MAX_PROP4 ) set(CMAKE_DEBUG_TARGET_PROPERTIES - BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 - STRING_PROP1 STRING_PROP2 STRING_PROP3 - NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 NUMBER_MIN_PROP5 - NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 NUMBER_MAX_PROP3 + BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 BOOL_PROP5 + STRING_PROP1 STRING_PROP2 STRING_PROP3 STRING_PROP4 + NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 NUMBER_MIN_PROP5 NUMBER_MIN_PROP6 + NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 NUMBER_MAX_PROP3 NUMBER_MAX_PROP4 ) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP5 ON) set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1) set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2) +set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP4 prop4) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP3 0x10) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP4 0x10) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP5 5) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP6 6) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP3 3) +set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP4 4) add_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) @@ -94,6 +102,44 @@ target_compile_definitions(CompatibleInterface $<$,100>:NUMBER_MAX_PROP1=100> $<$,250>:NUMBER_MAX_PROP2=250> $<$,3>:NUMBER_MAX_PROP3=3> + + # Static libraries compute COMPATIBLE_INTERFACE_ properties transitively. + $<$>:STATIC1_BOOL_PROP1> + $<$,prop1>:STATIC1_STRING_PROP1> + $<$,3>:STATIC1_NUMBER_MAX_PROP3> + $<$,5>:STATIC1_NUMBER_MIN_PROP5> + + # Object libraries do not compute COMPATIBLE_INTERFACE_ properties transitively. + $<$,>>:OBJECT1_BOOL_PROP1> + $<$,>>:OBJECT1_STRING_PROP1> + $<$,>>:OBJECT1_NUMBER_MAX_PROP3> + $<$,>>:OBJECT1_NUMBER_MIN_PROP5> + + # Interface libraries do not compute COMPATIBLE_INTERFACE_ properties transitively. + $<$,>>:IFACE3_BOOL_PROP1> + $<$,>>:IFACE3_STRING_PROP1> + $<$,>>:IFACE3_NUMBER_MAX_PROP3> + $<$,>>:IFACE3_NUMBER_MIN_PROP5> + + # Static libraries compute COMPATIBLE_INTERFACE_ properties transitively. + $<$>:STATIC1_BOOL_PROP5> + $<$,prop4>:STATIC1_STRING_PROP4> + $<$,6>:STATIC1_NUMBER_MIN_PROP6> + $<$,4>:STATIC1_NUMBER_MAX_PROP4> + + # Object libraries do not compute COMPATIBLE_INTERFACE_ properties transitively, + # but can have properties set on them. + $<$>:OBJECT1_BOOL_PROP5> + $<$,prop4>:OBJECT1_STRING_PROP4> + $<$,7>:OBJECT1_NUMBER_MIN_PROP6> + $<$,1>:OBJECT1_NUMBER_MAX_PROP4> + + # Interface libraries do not compute COMPATIBLE_INTERFACE_ properties transitively, + # but can have properties set on them. + $<$>:IFACE3_BOOL_PROP5> + $<$,prop4>:IFACE3_STRING_PROP4> + $<$,7>:IFACE3_NUMBER_MIN_PROP6> + $<$,1>:IFACE3_NUMBER_MAX_PROP4> ) @@ -134,3 +180,24 @@ set_property(TARGET CompatibleInterface APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL NON_RELEVANT_PROP ) + +add_library(static1 STATIC foo.cpp) +set_property(TARGET static1 PROPERTY BOOL_PROP5 ON) +set_property(TARGET static1 PROPERTY STRING_PROP4 prop4) +set_property(TARGET static1 PROPERTY NUMBER_MIN_PROP6 7) +set_property(TARGET static1 PROPERTY NUMBER_MAX_PROP4 1) +target_link_libraries(static1 PUBLIC iface1) + +add_library(object1 OBJECT foo.cpp) +set_property(TARGET object1 PROPERTY BOOL_PROP5 ON) +set_property(TARGET object1 PROPERTY STRING_PROP4 prop4) +set_property(TARGET object1 PROPERTY NUMBER_MIN_PROP6 7) +set_property(TARGET object1 PROPERTY NUMBER_MAX_PROP4 1) +target_link_libraries(object1 PUBLIC iface1) + +add_library(iface3 INTERFACE) +set_property(TARGET iface3 PROPERTY BOOL_PROP5 ON) +set_property(TARGET iface3 PROPERTY STRING_PROP4 prop4) +set_property(TARGET iface3 PROPERTY NUMBER_MIN_PROP6 7) +set_property(TARGET iface3 PROPERTY NUMBER_MAX_PROP4 1) +target_link_libraries(iface3 INTERFACE iface1) diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index b540888..2cd3c3f 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -23,6 +23,102 @@ # error Expected STRING_PROP3 #endif +#ifndef STATIC1_BOOL_PROP1 +# error Expected STATIC1_BOOL_PROP1 +#endif + +#ifndef STATIC1_STRING_PROP1 +# error Expected STATIC1_STRING_PROP1 +#endif + +#ifndef STATIC1_NUMBER_MAX_PROP3 +# error Expected STATIC1_NUMBER_MAX_PROP3 +#endif + +#ifndef STATIC1_NUMBER_MIN_PROP5 +# error Expected STATIC1_NUMBER_MIN_PROP5 +#endif + +#ifdef OBJECT1_BOOL_PROP1 +# error Unexpected OBJECT1_BOOL_PROP1 +#endif + +#ifdef OBJECT1_STRING_PROP1 +# error Unexpected OBJECT1_STRING_PROP1 +#endif + +#ifdef OBJECT1_NUMBER_MAX_PROP3 +# error Unexpected OBJECT1_NUMBER_MAX_PROP3 +#endif + +#ifdef OBJECT1_NUMBER_MIN_PROP5 +# error Unexpected OBJECT1_NUMBER_MIN_PROP5 +#endif + +#ifdef IFACE3_BOOL_PROP1 +# error Unexpected IFACE3_BOOL_PROP1 +#endif + +#ifdef IFACE3_STRING_PROP1 +# error Unexpected IFACE3_STRING_PROP1 +#endif + +#ifdef IFACE3_NUMBER_MAX_PROP3 +# error Unexpected IFACE3_NUMBER_MAX_PROP3 +#endif + +#ifdef IFACE3_NUMBER_MIN_PROP5 +# error Unexpected IFACE3_NUMBER_MIN_PROP5 +#endif + +#ifndef STATIC1_BOOL_PROP5 +# error Expected STATIC1_BOOL_PROP5 +#endif + +#ifndef STATIC1_STRING_PROP4 +# error Expected STATIC1_STRING_PROP4 +#endif + +#ifndef STATIC1_NUMBER_MIN_PROP6 +# error Expected STATIC1_NUMBER_MIN_PROP6 +#endif + +#ifndef STATIC1_NUMBER_MAX_PROP4 +# error Expected STATIC1_NUMBER_MAX_PROP4 +#endif + +#ifndef OBJECT1_BOOL_PROP5 +# error Expected OBJECT1_BOOL_PROP5 +#endif + +#ifndef OBJECT1_STRING_PROP4 +# error Expected OBJECT1_STRING_PROP4 +#endif + +#ifndef OBJECT1_NUMBER_MIN_PROP6 +# error Expected OBJECT1_NUMBER_MIN_PROP6 +#endif + +#ifndef OBJECT1_NUMBER_MAX_PROP4 +# error Expected OBJECT1_NUMBER_MAX_PROP4 +#endif + +#ifndef IFACE3_BOOL_PROP5 +# error Expected IFACE3_BOOL_PROP5 +#endif + +#ifndef IFACE3_STRING_PROP4 +# error Expected IFACE3_STRING_PROP4 +#endif + +#ifndef IFACE3_NUMBER_MIN_PROP6 +# error Expected IFACE3_NUMBER_MIN_PROP6 +#endif + +#ifndef IFACE3_NUMBER_MAX_PROP4 +# error Expected IFACE3_NUMBER_MAX_PROP4 +#endif + template struct CMakeStaticAssert; -- cgit v0.12 From 541a788264a6908ae6fe81e0afab3827c0877a38 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 16:55:36 -0400 Subject: Tests: Add COMPATIBLE_INTERFACE_ cases outside usage requirements --- Source/cmGeneratorExpressionNode.cxx | 4 ++++ Tests/CompatibleInterface/CMakeLists.txt | 41 ++++++++++++++++++++++++++++++++ Tests/CompatibleInterface/main.cpp | 12 +++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 4274448..94803da 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2968,6 +2968,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context->Config); return propContent ? propContent : ""; } + // FIXME: This duplicates the COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} + // evaluation below because it is not reached when evaluating outside of + // usage requirements, such as in add_custom_target, because there is no + // dagCheckerParent. if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, context->Config)) { context->HadContextSensitiveCondition = true; diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index da15ae9..4927329 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -201,3 +201,44 @@ set_property(TARGET iface3 PROPERTY STRING_PROP4 prop4) set_property(TARGET iface3 PROPERTY NUMBER_MIN_PROP6 7) set_property(TARGET iface3 PROPERTY NUMBER_MAX_PROP4 1) target_link_libraries(iface3 INTERFACE iface1) + +# Test COMPATIBLE_INTERFACE_* property evaluation outside of usage requirements. +add_custom_target(check ALL VERBATIM + COMMAND CompatibleInterface + # expect actual + "1" "$" + "prop1" "$" + "3" "$" + "5" "$" + + "1" "$" + "prop1" "$" + "3" "$" + "5" "$" + + "" "$" + "" "$" + "" "$" + "" "$" + + "" "$" + "" "$" + "" "$" + "" "$" + + "ON" "$" + "prop4" "$" + #FIXME: These two cases do not work correctly. + #"6" "$" + #"4" "$" + + "ON" "$" + "prop4" "$" + "7" "$" + "1" "$" + + "ON" "$" + "prop4" "$" + "7" "$" + "1" "$" + ) diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index 2cd3c3f..1205cca 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -1,3 +1,5 @@ +#include +#include #ifndef BOOL_PROP1 # error Expected BOOL_PROP1 @@ -149,6 +151,14 @@ __declspec(dllimport) int main(int argc, char** argv) { + int result = 0; + for (int i = 2; i < argc; i += 2) { + if (strcmp(argv[i - 1], argv[i]) != 0) { + fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i, + argv[i - 1], argv[i]); + result = 1; + } + } Iface2 if2; - return if2.foo() + foo() + bar(); + return result + if2.foo() + foo() + bar(); } -- cgit v0.12 From 86f99c5f6db76f2093edf0c5863f962fec93f7e8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 14:49:23 -0400 Subject: GenEx: Add COMPATIBLE_INTERFACE_ implementation comments --- Source/cmGeneratorExpressionNode.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 94803da..e3cb497 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2950,6 +2950,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return std::string(); } + // Properties named by COMPATIBLE_INTERFACE_ properties combine over + // the transitive link closure as a single order-independent value. + // Imported targets do not themselves have a defined value for these + // properties, but they can contribute to the value of a non-imported + // dependent. + // + // For COMPATIBLE_INTERFACE_{BOOL,STRING}: + // * If set on this target, use the value directly. It is checked + // elsewhere for consistency over the transitive link closure. + // * If not set on this target, compute the value from the closure. + // + // For COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} we always compute the value + // from this target and the transitive link closure to get the max or min. if (!haveProp && !target->IsImported() && target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { if (target->IsLinkInterfaceDependentBoolProperty(propertyName, @@ -2989,7 +3002,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return propContent ? propContent : ""; } } - if (!target->IsImported() && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) { if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, @@ -3010,6 +3022,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } } + // Some properties, such as usage requirements, combine over the + // transitive link closure as an ordered list. if (!interfacePropertyName.empty()) { result = cmGeneratorExpression::StripEmptyListElements( this->EvaluateDependentExpression(result, context->LG, context, target, -- cgit v0.12 From 061f7a6b9756bafa2d3d2f0ce86b6abd2b2e4598 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 15:11:58 -0400 Subject: GenEx: Remove redundant condition in COMPATIBLE_INTERFACE_ evaluation The `IsLinkInterfaceDependent*Property` methods internally exclude INTERFACE libraries since commit 0bfcb450e6 (INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties., 2013-11-20, v3.0.0-rc1~301^2~1). --- Source/cmGeneratorExpressionNode.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index e3cb497..65da33c 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2963,8 +2963,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode // // For COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} we always compute the value // from this target and the transitive link closure to get the max or min. - if (!haveProp && !target->IsImported() && - target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + if (!haveProp && !target->IsImported()) { if (target->IsLinkInterfaceDependentBoolProperty(propertyName, context->Config)) { context->HadContextSensitiveCondition = true; -- cgit v0.12 From c94cfe92eb579b07ab7a9bbb66d98090ec6fe840 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 13:37:46 -0400 Subject: GenEx: Fix COMPATIBLE_INTERFACE_ evaluation outside usage requirements In commit ff6c401309 (cmTarget: Add interface for compatible numeric properties, 2013-10-22, v3.0.0-rc1~460^2) the condition dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries() was written that way to avoid a nullptr dereference, but is actually meant to say "is not evaluating link libraries". That can also be true when there is no `dagCheckerParent`, such as when evaluating a generator expression outside of usage requirements, e.g., for `add_custom_target`. The original commit tried to account for that by duplicating the implementation in another code path, but that did not work in all cases. Fix the condition, remove the duplication, and enable tests for the now-working cases. --- Source/cmGeneratorExpressionNode.cxx | 23 +---------------------- Tests/CompatibleInterface/CMakeLists.txt | 5 ++--- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 65da33c..5c97e22 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2980,29 +2980,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context->Config); return propContent ? propContent : ""; } - // FIXME: This duplicates the COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} - // evaluation below because it is not reached when evaluating outside of - // usage requirements, such as in add_custom_target, because there is no - // dagCheckerParent. - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) { - context->HadContextSensitiveCondition = true; - const char* propContent = - target->GetLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) { - context->HadContextSensitiveCondition = true; - const char* propContent = - target->GetLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config); - return propContent ? propContent : ""; - } } - if (!target->IsImported() && dagCheckerParent && - !dagCheckerParent->EvaluatingLinkLibraries()) { + if (!evaluatingLinkLibraries && !target->IsImported()) { if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, context->Config)) { context->HadContextSensitiveCondition = true; diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 4927329..5d57ce4 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -228,9 +228,8 @@ add_custom_target(check ALL VERBATIM "ON" "$" "prop4" "$" - #FIXME: These two cases do not work correctly. - #"6" "$" - #"4" "$" + "6" "$" + "4" "$" "ON" "$" "prop4" "$" -- cgit v0.12