summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-06 13:49:20 +0100
committerStephen Kelly <steveire@gmail.com>2013-01-24 20:36:04 +0100
commit2fb2c32f9b304bc71b039754f9b9170fd6f27a6f (patch)
tree6afedbc38336f2cc032b81051fd3b9cadc23d5aa /Tests
parentcd66b9131d76984795c8a77353d6afa33abb54f7 (diff)
downloadcmake-2fb2c32f9b304bc71b039754f9b9170fd6f27a6f.tar.gz
Add the COMPATIBLE_INTERFACE_STRING property.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CompatibleInterface/CMakeLists.txt13
-rw-r--r--Tests/CompatibleInterface/main.cpp12
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt9
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt2
-rw-r--r--Tests/ExportImport/Import/A/deps_shared_iface.cpp4
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt1
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt5
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake11
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt1
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt3
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake11
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt1
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt3
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake10
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt1
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt4
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake9
-rw-r--r--Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake4
18 files changed, 103 insertions, 1 deletions
diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt
index 728065231a..259b5a1860 100644
--- a/Tests/CompatibleInterface/CMakeLists.txt
+++ b/Tests/CompatibleInterface/CMakeLists.txt
@@ -14,21 +14,34 @@ set_property(TARGET iface1 APPEND PROPERTY
BOOL_PROP3
BOOL_PROP4
)
+set_property(TARGET iface1 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_STRING
+ STRING_PROP1
+ STRING_PROP2
+ STRING_PROP3
+)
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)
add_executable(CompatibleInterface main.cpp)
target_link_libraries(CompatibleInterface iface1)
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)
target_compile_definitions(CompatibleInterface
PRIVATE
$<$<BOOL:$<TARGET_PROPERTY:BOOL_PROP1>>:BOOL_PROP1>
$<$<BOOL:$<TARGET_PROPERTY:BOOL_PROP2>>:BOOL_PROP2>
$<$<BOOL:$<TARGET_PROPERTY:BOOL_PROP3>>:BOOL_PROP3>
+ $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP1>,prop1>:STRING_PROP1>
+ $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP2>,prop2>:STRING_PROP2>
+ $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP3>,prop3>:STRING_PROP3>
)
diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp
index ae0e985c89..f5e6e38918 100644
--- a/Tests/CompatibleInterface/main.cpp
+++ b/Tests/CompatibleInterface/main.cpp
@@ -11,6 +11,18 @@
#error Expected BOOL_PROP3
#endif
+#ifndef STRING_PROP1
+#error Expected STRING_PROP1
+#endif
+
+#ifndef STRING_PROP2
+#error Expected STRING_PROP2
+#endif
+
+#ifndef STRING_PROP3
+#error Expected STRING_PROP3
+#endif
+
#include "iface2.h"
int main(int argc, char **argv)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 599229340d..eecfd6a319 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -181,7 +181,14 @@ set_property(TARGET testSharedLibRequired
PROPERTY
INTERFACE_CUSTOM_PROP ON
)
-
+set_property(TARGET testSharedLibRequired
+ APPEND PROPERTY
+ COMPATIBLE_INTERFACE_STRING CUSTOM_STRING
+)
+set_property(TARGET testSharedLibRequired
+ PROPERTY
+ INTERFACE_CUSTOM_STRING testcontent
+)
add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp)
set_property(TARGET testSharedLibDepends APPEND PROPERTY
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 4df57715b4..187c48ae0a 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -170,6 +170,7 @@ target_compile_definitions(deps_shared_iface
testSharedLibDepends
$<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:PIC_PROPERTY_IS_ON>
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
+ $<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
)
if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -201,4 +202,5 @@ target_compile_definitions(deps_shared_iface2
PRIVATE bld_testSharedLibDepends TEST_SUBDIR_LIB
$<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:PIC_PROPERTY_IS_ON>
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
+ $<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
)
diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp
index a33f200ecd..2f0e74a07b 100644
--- a/Tests/ExportImport/Import/A/deps_shared_iface.cpp
+++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp
@@ -16,6 +16,10 @@
#error Expected CUSTOM_PROPERTY_IS_ON
#endif
+#ifndef CUSTOM_STRING_IS_MATCH
+#error Expected CUSTOM_STRING_IS_MATCH
+#endif
+
#ifdef TEST_SUBDIR_LIB
#include "subdir.h"
#endif
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt
new file mode 100644
index 0000000000..6a293b4f11
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error in CMakeLists.txt:
+ Target "foo" has property "INCLUDE_DIRECTORIES" listed in its
+ COMPATIBLE_INTERFACE_STRING property. This is not allowed. Only
+ user-defined properties may appear listed in the
+ COMPATIBLE_INTERFACE_STRING property.
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake
new file mode 100644
index 0000000000..5221a129c6
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-builtin-prop.cmake
@@ -0,0 +1,11 @@
+
+add_library(foo UNKNOWN IMPORTED)
+add_library(bar UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING INCLUDE_DIRECTORIES)
+set_property(TARGET foo PROPERTY INTERFACE_INCLUDE_DIRECTORIES foo_inc)
+set_property(TARGET bar PROPERTY INTERFACE_INCLUDE_DIRECTORIES bar_inc)
+
+add_executable(user main.cpp)
+set_property(TARGET user PROPERTY INCLUDE_DIRECTORIES bar_inc)
+target_link_libraries(user foo bar)
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt
new file mode 100644
index 0000000000..0476da97d2
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error: Property SOMEPROP on target "user" does
+not match the INTERFACE_SOMEPROP property requirement
+of dependency "foo".
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake
new file mode 100644
index 0000000000..187f29f796
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depend-self.cmake
@@ -0,0 +1,11 @@
+
+add_library(foo UNKNOWN IMPORTED)
+add_library(bar UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMEPROP)
+set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP prop)
+set_property(TARGET bar PROPERTY INTERFACE_SOMEPROP prop)
+
+add_executable(user main.cpp)
+set_property(TARGET user PROPERTY SOMEPROP different)
+target_link_libraries(user foo bar)
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt
new file mode 100644
index 0000000000..d885c09d95
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error: The INTERFACE_SOMEPROP property of "bar" does
+not agree with the value of SOMEPROP already determined
+for "user".
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake
new file mode 100644
index 0000000000..73cc3fc55b
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatch-depends.cmake
@@ -0,0 +1,10 @@
+
+add_library(foo UNKNOWN IMPORTED)
+add_library(bar UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMEPROP)
+set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP foo)
+set_property(TARGET bar PROPERTY INTERFACE_SOMEPROP bar)
+
+add_executable(user main.cpp)
+target_link_libraries(user foo bar)
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt
new file mode 100644
index 0000000000..723daec098
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error: Property SOMEPROP on target "user" is
+implied to be empty because it was used to determine the link libraries
+already. The INTERFACE_SOMEPROP property on
+dependency "foo" is in conflict.
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake
new file mode 100644
index 0000000000..af3ce8fbc8
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-mismatched-use.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo UNKNOWN IMPORTED)
+add_library(bar UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMEPROP)
+set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP prop)
+
+add_executable(user main.cpp)
+target_link_libraries(user foo $<$<STREQUAL:$<TARGET_PROPERTY:SOMEPROP>,prop>:bar>)
diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
index ba8917b865..922ad7fc73 100644
--- a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
@@ -4,3 +4,7 @@ run_cmake(InterfaceBool-mismatch-depends)
run_cmake(InterfaceBool-mismatch-depend-self)
run_cmake(InterfaceBool-mismatched-use)
run_cmake(InterfaceBool-builtin-prop)
+run_cmake(InterfaceString-mismatch-depends)
+run_cmake(InterfaceString-mismatch-depend-self)
+run_cmake(InterfaceString-mismatched-use)
+run_cmake(InterfaceString-builtin-prop)