summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-09 14:49:49 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-11-09 14:49:49 (GMT)
commit453df662bafe52ec87e0972323cf87ec737f3437 (patch)
treecf5326c1c63bfee5079353699bcc09d982e4fe66 /Tests
parent25085f41b20f7f5a5fb25e8ab683f77476f917a2 (diff)
parent09cda9d5e7bb31f05177bdaf11d24aeaf85a8dd3 (diff)
downloadCMake-453df662bafe52ec87e0972323cf87ec737f3437.zip
CMake-453df662bafe52ec87e0972323cf87ec737f3437.tar.gz
CMake-453df662bafe52ec87e0972323cf87ec737f3437.tar.bz2
Merge topic 'imported-interface-libname'
09cda9d5 Allow imported INTERFACE libraries to specify a link library name 1d1f1eeb cmTarget: Refactor GetMappedConfig to choose location property up front 479932fa cmTarget: Add comment clarifying interface library special case 925e4270 cmTarget: Clarify comments in GetMappedConfig
Diffstat (limited to 'Tests')
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt19
-rw-r--r--Tests/InterfaceLibrary/definetestexe.cpp3
-rw-r--r--Tests/InterfaceLibrary/item.cpp4
-rw-r--r--Tests/InterfaceLibrary/item_fake.cpp5
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt44
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake6
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt45
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake17
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt21
-rw-r--r--Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake5
-rw-r--r--Tests/RunCMake/interface_library/RunCMakeTest.cmake3
14 files changed, 173 insertions, 2 deletions
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index ee81419..3db210a 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -25,8 +25,25 @@ target_sources(iface_objlib INTERFACE $<TARGET_OBJECTS:objlib>)
add_library(intermediate INTERFACE)
target_link_libraries(intermediate INTERFACE iface_objlib)
+add_library(item_fake_tgt STATIC item_fake.cpp)
+set_property(TARGET item_fake_tgt PROPERTY OUTPUT_NAME item_fake)
+add_library(item_real STATIC item.cpp)
+add_library(item_iface INTERFACE IMPORTED)
+set_property(TARGET item_iface PROPERTY IMPORTED_LIBNAME item_real)
+add_dependencies(item_iface item_real)
+link_directories(${CMAKE_CURRENT_BINARY_DIR})
+
add_executable(InterfaceLibrary definetestexe.cpp)
-target_link_libraries(InterfaceLibrary iface_nodepends headeriface subiface intermediate)
+target_link_libraries(InterfaceLibrary
+ iface_nodepends
+ headeriface
+ subiface
+ intermediate
+
+ item_iface
+ item_fake # ensure that 'item_real' is ordered in place of item_iface
+ )
+add_dependencies(InterfaceLibrary item_fake_tgt)
add_subdirectory(libsdir)
diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp
index a6b5592..098502c 100644
--- a/Tests/InterfaceLibrary/definetestexe.cpp
+++ b/Tests/InterfaceLibrary/definetestexe.cpp
@@ -17,8 +17,9 @@
extern int obj();
extern int sub();
+extern int item();
int main(int, char**)
{
- return obj() + sub();
+ return obj() + sub() + item();
}
diff --git a/Tests/InterfaceLibrary/item.cpp b/Tests/InterfaceLibrary/item.cpp
new file mode 100644
index 0000000..85cda1b
--- /dev/null
+++ b/Tests/InterfaceLibrary/item.cpp
@@ -0,0 +1,4 @@
+int item()
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLibrary/item_fake.cpp b/Tests/InterfaceLibrary/item_fake.cpp
new file mode 100644
index 0000000..b4bd829
--- /dev/null
+++ b/Tests/InterfaceLibrary/item_fake.cpp
@@ -0,0 +1,5 @@
+extern int item_undefined();
+int item()
+{
+ return item_undefined();
+}
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt
new file mode 100644
index 0000000..454c655
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value-stderr.txt
@@ -0,0 +1,44 @@
+^CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property value
+
+ -flag
+
+ may not start with '-'.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property value
+
+ item1;item2
+
+ may not contain ';'.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property value
+
+ /path/to/item1
+
+ may not contain '/'.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property value
+
+ \\path\\to\\item1
+
+ may not contain '\\'.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-bad-value.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property value
+
+ c:\\path\\to\\item1
+
+ may not contain ':'.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake
new file mode 100644
index 0000000..1af65b4
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-bad-value.cmake
@@ -0,0 +1,6 @@
+add_library(MyTarget INTERFACE IMPORTED)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME -flag)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME item1 item2)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME /path/to/item1)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME \\path\\to\\item1)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME c:\\path\\to\\item1)
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt
new file mode 100644
index 0000000..3a329d2
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface-stderr.txt
@@ -0,0 +1,45 @@
+^CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may be set only on imported INTERFACE library
+ targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may not be APPENDed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME_DEBUG property may be set only on imported INTERFACE
+ library targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME_DEBUG property may not be APPENDed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may be set only on imported INTERFACE library
+ targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may be set only on imported INTERFACE library
+ targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may be set only on imported INTERFACE library
+ targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-iface.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may be set only on imported INTERFACE library
+ targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake
new file mode 100644
index 0000000..fe6841a
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-iface.cmake
@@ -0,0 +1,17 @@
+add_custom_target(MyCustom)
+set_property(TARGET MyCustom PROPERTY IMPORTED_LIBNAME item1)
+set_property(TARGET MyCustom APPEND PROPERTY IMPORTED_LIBNAME item2)
+set_property(TARGET MyCustom PROPERTY IMPORTED_LIBNAME_DEBUG item1)
+set_property(TARGET MyCustom APPEND PROPERTY IMPORTED_LIBNAME_DEBUG item2)
+
+add_library(MyStatic STATIC IMPORTED)
+set_property(TARGET MyStatic PROPERTY IMPORTED_LIBNAME item1)
+
+add_library(MyShared SHARED IMPORTED)
+set_property(TARGET MyShared PROPERTY IMPORTED_LIBNAME item1)
+
+add_library(MyModule MODULE IMPORTED)
+set_property(TARGET MyModule PROPERTY IMPORTED_LIBNAME item1)
+
+add_executable(MyExe IMPORTED)
+set_property(TARGET MyExe PROPERTY IMPORTED_LIBNAME item1)
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt
new file mode 100644
index 0000000..e9d94cf
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported-stderr.txt
@@ -0,0 +1,21 @@
+^CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may be set only on imported INTERFACE library
+ targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME property may not be APPENDed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME_DEBUG property may be set only on imported INTERFACE
+ library targets.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at IMPORTED_LIBNAME-non-imported.cmake:[0-9]+ \(set_property\):
+ IMPORTED_LIBNAME_DEBUG property may not be APPENDed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake
new file mode 100644
index 0000000..07a67d7
--- /dev/null
+++ b/Tests/RunCMake/interface_library/IMPORTED_LIBNAME-non-imported.cmake
@@ -0,0 +1,5 @@
+add_library(MyTarget INTERFACE)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME item1)
+set_property(TARGET MyTarget APPEND PROPERTY IMPORTED_LIBNAME item2)
+set_property(TARGET MyTarget PROPERTY IMPORTED_LIBNAME_DEBUG item1)
+set_property(TARGET MyTarget APPEND PROPERTY IMPORTED_LIBNAME_DEBUG item2)
diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
index 201daa7..5a6af1d 100644
--- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
@@ -8,3 +8,6 @@ run_cmake(invalid_signature)
run_cmake(global-interface)
run_cmake(genex_link)
run_cmake(add_custom_command-TARGET)
+run_cmake(IMPORTED_LIBNAME-bad-value)
+run_cmake(IMPORTED_LIBNAME-non-iface)
+run_cmake(IMPORTED_LIBNAME-non-imported)