diff options
author | Brad King <brad.king@kitware.com> | 2024-04-11 20:55:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-04-11 22:34:19 (GMT) |
commit | 541a788264a6908ae6fe81e0afab3827c0877a38 (patch) | |
tree | da54cc8d29444dbbc72fff9eb5a29d4953e0e491 /Tests/CompatibleInterface | |
parent | 5ebcf961702e723b69e777f4286bca357d2b5fad (diff) | |
download | CMake-541a788264a6908ae6fe81e0afab3827c0877a38.zip CMake-541a788264a6908ae6fe81e0afab3827c0877a38.tar.gz CMake-541a788264a6908ae6fe81e0afab3827c0877a38.tar.bz2 |
Tests: Add COMPATIBLE_INTERFACE_ cases outside usage requirements
Diffstat (limited to 'Tests/CompatibleInterface')
-rw-r--r-- | Tests/CompatibleInterface/CMakeLists.txt | 41 | ||||
-rw-r--r-- | Tests/CompatibleInterface/main.cpp | 12 |
2 files changed, 52 insertions, 1 deletions
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" "$<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>" + ) 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 <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(); } |