mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
Tests: Add COMPATIBLE_INTERFACE_ cases outside usage requirements
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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" "$<TARGET_PROPERTY:CompatibleInterface,BOOL_PROP1>"
|
||||
"prop1" "$<TARGET_PROPERTY:CompatibleInterface,STRING_PROP1>"
|
||||
"3" "$<TARGET_PROPERTY:CompatibleInterface,NUMBER_MAX_PROP3>"
|
||||
"5" "$<TARGET_PROPERTY:CompatibleInterface,NUMBER_MIN_PROP5>"
|
||||
|
||||
"1" "$<TARGET_PROPERTY:static1,BOOL_PROP1>"
|
||||
"prop1" "$<TARGET_PROPERTY:static1,STRING_PROP1>"
|
||||
"3" "$<TARGET_PROPERTY:static1,NUMBER_MAX_PROP3>"
|
||||
"5" "$<TARGET_PROPERTY:static1,NUMBER_MIN_PROP5>"
|
||||
|
||||
"" "$<TARGET_PROPERTY:object1,BOOL_PROP1>"
|
||||
"" "$<TARGET_PROPERTY:object1,STRING_PROP1>"
|
||||
"" "$<TARGET_PROPERTY:object1,NUMBER_MAX_PROP3>"
|
||||
"" "$<TARGET_PROPERTY:object1,NUMBER_MIN_PROP5>"
|
||||
|
||||
"" "$<TARGET_PROPERTY:iface3,BOOL_PROP1>"
|
||||
"" "$<TARGET_PROPERTY:iface3,STRING_PROP1>"
|
||||
"" "$<TARGET_PROPERTY:iface3,NUMBER_MAX_PROP3>"
|
||||
"" "$<TARGET_PROPERTY:iface3,NUMBER_MIN_PROP5>"
|
||||
|
||||
"ON" "$<TARGET_PROPERTY:static1,BOOL_PROP5>"
|
||||
"prop4" "$<TARGET_PROPERTY:static1,STRING_PROP4>"
|
||||
#FIXME: These two cases do not work correctly.
|
||||
#"6" "$<TARGET_PROPERTY:static1,NUMBER_MIN_PROP6>"
|
||||
#"4" "$<TARGET_PROPERTY:static1,NUMBER_MAX_PROP4>"
|
||||
|
||||
"ON" "$<TARGET_PROPERTY:object1,BOOL_PROP5>"
|
||||
"prop4" "$<TARGET_PROPERTY:object1,STRING_PROP4>"
|
||||
"7" "$<TARGET_PROPERTY:object1,NUMBER_MIN_PROP6>"
|
||||
"1" "$<TARGET_PROPERTY:object1,NUMBER_MAX_PROP4>"
|
||||
|
||||
"ON" "$<TARGET_PROPERTY:iface3,BOOL_PROP5>"
|
||||
"prop4" "$<TARGET_PROPERTY:iface3,STRING_PROP4>"
|
||||
"7" "$<TARGET_PROPERTY:iface3,NUMBER_MIN_PROP6>"
|
||||
"1" "$<TARGET_PROPERTY:iface3,NUMBER_MAX_PROP4>"
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user