summaryrefslogtreecommitdiffstats
path: root/Tests/ObjectLibrary
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-04 17:58:29 (GMT)
committerBrad King <brad.king@kitware.com>2020-03-04 18:04:00 (GMT)
commit3b3de0fd17d45f1927a28b4c52ba5146325b1bb0 (patch)
tree3fc85a5344abb0e0d6544e804ad11eb629464290 /Tests/ObjectLibrary
parent07a7bc0e3fc370eaa5593cffcd07c0ea739cfc9c (diff)
downloadCMake-3b3de0fd17d45f1927a28b4c52ba5146325b1bb0.zip
CMake-3b3de0fd17d45f1927a28b4c52ba5146325b1bb0.tar.gz
CMake-3b3de0fd17d45f1927a28b4c52ba5146325b1bb0.tar.bz2
Tests: Extend ObjectLibrary test with case for object lib dependencies
Add the test case from commit bab24e782c (target_link_libraries: Propagate dependencies of object libraries, 2018-12-10, v3.14.0-rc1~260^2) to the main ObjectLibrary test.
Diffstat (limited to 'Tests/ObjectLibrary')
-rw-r--r--Tests/ObjectLibrary/CMakeLists.txt2
-rw-r--r--Tests/ObjectLibrary/Transitive/CMakeLists.txt7
-rw-r--r--Tests/ObjectLibrary/Transitive/FooObject.c4
-rw-r--r--Tests/ObjectLibrary/Transitive/FooStatic.c4
-rw-r--r--Tests/ObjectLibrary/Transitive/Transitive.c7
5 files changed, 24 insertions, 0 deletions
diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt
index 7897ab9..fca5f41 100644
--- a/Tests/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ObjectLibrary/CMakeLists.txt
@@ -73,3 +73,5 @@ add_executable(UseABstaticObjs $<TARGET_OBJECTS:UseABstatic>)
target_link_libraries(UseABstaticObjs ABstatic)
add_subdirectory(ExportLanguages)
+
+add_subdirectory(Transitive)
diff --git a/Tests/ObjectLibrary/Transitive/CMakeLists.txt b/Tests/ObjectLibrary/Transitive/CMakeLists.txt
new file mode 100644
index 0000000..c0a4ac3
--- /dev/null
+++ b/Tests/ObjectLibrary/Transitive/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0022 NEW)
+add_library(FooStatic STATIC FooStatic.c)
+
+add_library(FooObject1 OBJECT FooObject.c)
+target_link_libraries(FooObject1 PRIVATE FooStatic)
+add_executable(Transitive1 Transitive.c)
+target_link_libraries(Transitive1 PRIVATE FooObject1)
diff --git a/Tests/ObjectLibrary/Transitive/FooObject.c b/Tests/ObjectLibrary/Transitive/FooObject.c
new file mode 100644
index 0000000..54c1f29
--- /dev/null
+++ b/Tests/ObjectLibrary/Transitive/FooObject.c
@@ -0,0 +1,4 @@
+int FooObject(void)
+{
+ return 0;
+}
diff --git a/Tests/ObjectLibrary/Transitive/FooStatic.c b/Tests/ObjectLibrary/Transitive/FooStatic.c
new file mode 100644
index 0000000..84649c7
--- /dev/null
+++ b/Tests/ObjectLibrary/Transitive/FooStatic.c
@@ -0,0 +1,4 @@
+int FooStatic(void)
+{
+ return 0;
+}
diff --git a/Tests/ObjectLibrary/Transitive/Transitive.c b/Tests/ObjectLibrary/Transitive/Transitive.c
new file mode 100644
index 0000000..43089b8
--- /dev/null
+++ b/Tests/ObjectLibrary/Transitive/Transitive.c
@@ -0,0 +1,7 @@
+extern int FooObject(void);
+extern int FooStatic(void);
+
+int main(void)
+{
+ return FooObject() + FooStatic();
+}