diff options
author | Brad King <brad.king@kitware.com> | 2020-03-05 12:26:12 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-03-05 12:26:18 (GMT) |
commit | fee2b209b822cd26fb2156e6f0859290b4eaa5e5 (patch) | |
tree | 9f33d2aadb2afe111b3aa3f9f6b71e927b980177 /Tests | |
parent | da47b8f60f25e689ad91f65a19613d96f669629f (diff) | |
parent | a833aa1167f879544e17a41b36948f4059622db5 (diff) | |
download | CMake-fee2b209b822cd26fb2156e6f0859290b4eaa5e5.zip CMake-fee2b209b822cd26fb2156e6f0859290b4eaa5e5.tar.gz CMake-fee2b209b822cd26fb2156e6f0859290b4eaa5e5.tar.bz2 |
Merge topic 'objlib-transitive-deps'
a833aa1167 Fix dependencies on targets linked through object libraries
3b3de0fd17 Tests: Extend ObjectLibrary test with case for object lib dependencies
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4427
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ObjectLibrary/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/ObjectLibrary/Transitive/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/ObjectLibrary/Transitive/FooObject.c | 4 | ||||
-rw-r--r-- | Tests/ObjectLibrary/Transitive/FooStatic.c | 4 | ||||
-rw-r--r-- | Tests/ObjectLibrary/Transitive/Transitive.c | 7 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json | 15 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json | 15 |
7 files changed, 57 insertions, 2 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..d616cda --- /dev/null +++ b/Tests/ObjectLibrary/Transitive/CMakeLists.txt @@ -0,0 +1,12 @@ +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) + +add_library(FooObject2 OBJECT FooObject.c) +target_link_libraries(FooObject2 INTERFACE FooStatic) +add_executable(Transitive2 Transitive.c) +target_link_libraries(Transitive2 PRIVATE FooObject2) 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(); +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json index 91951c3..3c9ace3 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json @@ -131,7 +131,20 @@ "dependencies": [ { "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": null + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 7, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] }, { "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json index a33370a..119c91d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json @@ -131,7 +131,20 @@ "dependencies": [ { "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": null + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 11, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] }, { "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", |