summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-25 12:37:16 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-07-25 12:37:16 (GMT)
commit2f8dace125a0d0f7e731e439eaa4a2a27b687248 (patch)
treecc72af0370f2dd833b7a163bda1b2d1690c76509 /Tests
parent9f8fcdd2d8a819d00fcea28be52aede1e8b698ec (diff)
parentb655865bbf85e0bb9587dea099c5996836f48cb8 (diff)
downloadCMake-2f8dace125a0d0f7e731e439eaa4a2a27b687248.zip
CMake-2f8dace125a0d0f7e731e439eaa4a2a27b687248.tar.gz
CMake-2f8dace125a0d0f7e731e439eaa4a2a27b687248.tar.bz2
Merge topic 'tll-new-signatures'
b655865 target_link_libraries: Add PUBLIC/PRIVATE/INTERFACE keyword signature
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt6
-rw-r--r--Tests/CMakeCommands/target_link_libraries/newsignature1.cpp19
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt16
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake11
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt16
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake11
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt16
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt16
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/target_link_libraries/MixedSignature-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/MixedSignature.cmake6
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries/empty.cpp7
-rw-r--r--Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp1
-rw-r--r--Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp1
-rw-r--r--Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp1
24 files changed, 175 insertions, 0 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index 2240539..06019e6 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -124,3 +124,9 @@ add_library(libConsumer empty.cpp)
target_link_libraries(libConsumer debug depA)
add_subdirectory(cmp0022)
+
+add_executable(newsignature1 newsignature1.cpp)
+target_link_libraries(newsignature1 PRIVATE depC INTERFACE depD PUBLIC depB PRIVATE subdirlib INTERFACE INTERFACE PUBLIC)
+
+assert_property(newsignature1 INTERFACE_LINK_LIBRARIES "depD;depB")
+assert_property(newsignature1 LINK_LIBRARIES "depC;depB;subdirlib")
diff --git a/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp b/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp
new file mode 100644
index 0000000..d1321a1
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/newsignature1.cpp
@@ -0,0 +1,19 @@
+
+#include "depB.h"
+#include "depC.h"
+#include "depIfaceOnly.h"
+
+#include "subdirlib.h"
+
+int main(int, char **)
+{
+ DepA a;
+ DepB b;
+ DepC c;
+
+ DepIfaceOnly iface_only;
+
+ SubDirLibObject sd;
+
+ return a.foo() + b.foo() + c.foo() + iface_only.foo() + sd.foo();
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 66ce3f1..12f68d7 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -115,3 +115,4 @@ if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
endif()
add_RunCMake_test(File_Generate)
+add_RunCMake_test(target_link_libraries)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt
new file mode 100644
index 0000000..d27686d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt
@@ -0,0 +1,16 @@
+CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\):
+ Policy CMP0023 is not set: Plain and keyword target_link_libraries
+ signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The plain signature for target_link_libraries has already been used with
+ the target "foo". All uses of target_link_libraries with a target must be
+ either all-keyword or all-plain.
+
+ The uses of the plain signature are here:
+
+ \* CMP0023-NEW-2.cmake:10 \(target_link_libraries\)
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake
new file mode 100644
index 0000000..f8b3546
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2.cmake
@@ -0,0 +1,11 @@
+
+project(CMP0022-WARN)
+
+cmake_policy(SET CMP0023 NEW)
+
+add_library(foo SHARED empty_vs6_1.cpp)
+add_library(bar SHARED empty_vs6_2.cpp)
+add_library(bat SHARED empty_vs6_3.cpp)
+
+target_link_libraries(foo bar)
+target_link_libraries(foo LINK_PRIVATE bat)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt
new file mode 100644
index 0000000..d7be0ff
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt
@@ -0,0 +1,16 @@
+CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\):
+ Policy CMP0023 is not set: Plain and keyword target_link_libraries
+ signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The plain signature for target_link_libraries has already been used with
+ the target "foo". All uses of target_link_libraries with a target must be
+ either all-keyword or all-plain.
+
+ The uses of the plain signature are here:
+
+ \* CMP0023-NEW.cmake:10 \(target_link_libraries\)
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake
new file mode 100644
index 0000000..f0aa63f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW.cmake
@@ -0,0 +1,11 @@
+
+project(CMP0022-WARN)
+
+cmake_policy(SET CMP0023 NEW)
+
+add_library(foo SHARED empty_vs6_1.cpp)
+add_library(bar SHARED empty_vs6_2.cpp)
+add_library(bat SHARED empty_vs6_3.cpp)
+
+target_link_libraries(foo bar)
+target_link_libraries(foo PRIVATE bat)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt
new file mode 100644
index 0000000..5147861
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2-stderr.txt
@@ -0,0 +1,16 @@
+CMake Warning \(dev\) at CMP0023-WARN-2.cmake:9 \(target_link_libraries\):
+ Policy CMP0023 is not set: Plain and keyword target_link_libraries
+ signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The plain signature for target_link_libraries has already been used with
+ the target "foo". All uses of target_link_libraries with a target should
+ be either all-keyword or all-plain.
+
+ The uses of the plain signature are here:
+
+ \* CMP0023-WARN-2.cmake:8 \(target_link_libraries\)
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake
new file mode 100644
index 0000000..2e9cba8
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-2.cmake
@@ -0,0 +1,9 @@
+
+project(CMP0022-WARN)
+
+add_library(foo SHARED empty_vs6_1.cpp)
+add_library(bar SHARED empty_vs6_2.cpp)
+add_library(bat SHARED empty_vs6_3.cpp)
+
+target_link_libraries(foo bar)
+target_link_libraries(foo LINK_PRIVATE bat)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt
new file mode 100644
index 0000000..a7474fa
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN-stderr.txt
@@ -0,0 +1,16 @@
+CMake Warning \(dev\) at CMP0023-WARN.cmake:9 \(target_link_libraries\):
+ Policy CMP0023 is not set: Plain and keyword target_link_libraries
+ signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ The plain signature for target_link_libraries has already been used with
+ the target "foo". All uses of target_link_libraries with a target should
+ be either all-keyword or all-plain.
+
+ The uses of the plain signature are here:
+
+ \* CMP0023-WARN.cmake:8 \(target_link_libraries\)
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake
new file mode 100644
index 0000000..fcc8da0
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0023-WARN.cmake
@@ -0,0 +1,9 @@
+
+project(CMP0022-WARN)
+
+add_library(foo SHARED empty_vs6_1.cpp)
+add_library(bar SHARED empty_vs6_2.cpp)
+add_library(bat SHARED empty_vs6_3.cpp)
+
+target_link_libraries(foo bar)
+target_link_libraries(foo PRIVATE bat)
diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature-result.txt b/Tests/RunCMake/target_link_libraries/MixedSignature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/MixedSignature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt
new file mode 100644
index 0000000..a0c66db
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at MixedSignature.cmake:6 \(target_link_libraries\):
+ The PUBLIC or PRIVATE option must appear as the second argument, just after
+ the target name.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/MixedSignature.cmake b/Tests/RunCMake/target_link_libraries/MixedSignature.cmake
new file mode 100644
index 0000000..fa70685
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/MixedSignature.cmake
@@ -0,0 +1,6 @@
+
+add_library(foo empty_vs6_1.cpp)
+add_library(bar empty_vs6_2.cpp)
+add_library(bat empty_vs6_3.cpp)
+
+target_link_libraries(foo LINK_PUBLIC bar PRIVATE bat)
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
new file mode 100644
index 0000000..f97022e
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(CMP0023-WARN)
+run_cmake(CMP0023-NEW)
+run_cmake(CMP0023-WARN-2)
+run_cmake(CMP0023-NEW-2)
+run_cmake(MixedSignature)
+run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses)
diff --git a/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake
new file mode 100644
index 0000000..e32891d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/Separate-PRIVATE-LINK_PRIVATE-uses.cmake
@@ -0,0 +1,9 @@
+
+enable_language(CXX)
+
+add_library(foo empty_vs6_1.cpp)
+add_library(bar empty_vs6_2.cpp)
+add_library(bat empty_vs6_3.cpp)
+
+target_link_libraries(foo LINK_PRIVATE bar)
+target_link_libraries(foo PRIVATE bat)
diff --git a/Tests/RunCMake/target_link_libraries/empty.cpp b/Tests/RunCMake/target_link_libraries/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp b/Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp
new file mode 100644
index 0000000..7efedab
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty_vs6_1.cpp
@@ -0,0 +1 @@
+#include "empty.cpp"
diff --git a/Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp b/Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp
new file mode 100644
index 0000000..7efedab
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty_vs6_2.cpp
@@ -0,0 +1 @@
+#include "empty.cpp"
diff --git a/Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp b/Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp
new file mode 100644
index 0000000..7efedab
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty_vs6_3.cpp
@@ -0,0 +1 @@
+#include "empty.cpp"