summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-26 14:28:30 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-26 14:28:30 (GMT)
commit4025013dd78abeaef772eee1fc532ce275ae4216 (patch)
tree313d9ed0302f457507c375a1ea32f23db6d47ff5 /Tests
parent5f789db847a86cbdfb94fcf1abd4d561a6942d65 (diff)
parentff6c401309761f0c0061f1084f2e3150038962a5 (diff)
downloadCMake-4025013dd78abeaef772eee1fc532ce275ae4216.zip
CMake-4025013dd78abeaef772eee1fc532ce275ae4216.tar.gz
CMake-4025013dd78abeaef772eee1fc532ce275ae4216.tar.bz2
Merge topic 'compatible-interface-numbers'
ff6c401 cmTarget: Add interface for compatible numeric properties e4e20c1 cmTarget: Add enumeration for consistency to expect from properties. 9877769 cmTarget: Assign consistent content back to the property being evaluated. 816b4a8 cmTarget: Make consistentProperty return consistent content. 030800a cmTarget: Add a template to create correct implied content.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CompatibleInterface/CMakeLists.txt22
-rw-r--r--Tests/CompatibleInterface/main.cpp13
2 files changed, 35 insertions, 0 deletions
diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt
index 5ee9fd7..8186c61 100644
--- a/Tests/CompatibleInterface/CMakeLists.txt
+++ b/Tests/CompatibleInterface/CMakeLists.txt
@@ -20,11 +20,25 @@ set_property(TARGET iface1 APPEND PROPERTY
STRING_PROP2
STRING_PROP3
)
+set_property(TARGET iface1 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_NUMBER_MIN
+ NUMBER_MIN_PROP1
+ NUMBER_MIN_PROP2
+)
+set_property(TARGET iface1 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_NUMBER_MAX
+ NUMBER_MAX_PROP1
+ NUMBER_MAX_PROP2
+)
set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON)
set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 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_NUMBER_MIN_PROP1 100)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200)
add_executable(CompatibleInterface main.cpp)
target_link_libraries(CompatibleInterface iface1)
@@ -33,6 +47,10 @@ set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON)
set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON)
set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2)
set_property(TARGET CompatibleInterface PROPERTY STRING_PROP3 prop3)
+set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP1 50)
+set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP2 250)
+set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP1 50)
+set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP2 250)
target_compile_definitions(CompatibleInterface
PRIVATE
@@ -42,6 +60,10 @@ target_compile_definitions(CompatibleInterface
$<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP1>,prop1>:STRING_PROP1>
$<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP2>,prop2>:STRING_PROP2>
$<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP3>,prop3>:STRING_PROP3>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP1>,50>:NUMBER_MIN_PROP1=50>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP2>,200>:NUMBER_MIN_PROP2=200>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP1>,100>:NUMBER_MAX_PROP1=100>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP2>,250>:NUMBER_MAX_PROP2=250>
)
diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp
index f5e6e38..fa299e9 100644
--- a/Tests/CompatibleInterface/main.cpp
+++ b/Tests/CompatibleInterface/main.cpp
@@ -23,6 +23,19 @@
#error Expected STRING_PROP3
#endif
+template<bool test>
+struct CMakeStaticAssert;
+
+template<>
+struct CMakeStaticAssert<true> {};
+
+enum {
+ NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>),
+ NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>),
+ NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>),
+ NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>)
+};
+
#include "iface2.h"
int main(int argc, char **argv)