From 3b3de0fd17d45f1927a28b4c52ba5146325b1bb0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Mar 2020 12:58:29 -0500 Subject: [PATCH] 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. --- Tests/ObjectLibrary/CMakeLists.txt | 2 ++ Tests/ObjectLibrary/Transitive/CMakeLists.txt | 7 +++++++ Tests/ObjectLibrary/Transitive/FooObject.c | 4 ++++ Tests/ObjectLibrary/Transitive/FooStatic.c | 4 ++++ Tests/ObjectLibrary/Transitive/Transitive.c | 7 +++++++ 5 files changed, 24 insertions(+) create mode 100644 Tests/ObjectLibrary/Transitive/CMakeLists.txt create mode 100644 Tests/ObjectLibrary/Transitive/FooObject.c create mode 100644 Tests/ObjectLibrary/Transitive/FooStatic.c create mode 100644 Tests/ObjectLibrary/Transitive/Transitive.c diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 7897ab99bd..fca5f410fd 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -73,3 +73,5 @@ add_executable(UseABstaticObjs $) 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 0000000000..c0a4ac3d56 --- /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 0000000000..54c1f299a3 --- /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 0000000000..84649c7c3e --- /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 0000000000..43089b8c2a --- /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(); +}