mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'objlib-transitive-deps'
a833aa1167Fix dependencies on targets linked through object libraries3b3de0fd17Tests: Extend ObjectLibrary test with case for object lib dependencies Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4427
This commit is contained in:
@@ -73,3 +73,5 @@ add_executable(UseABstaticObjs $<TARGET_OBJECTS:UseABstatic>)
|
||||
target_link_libraries(UseABstaticObjs ABstatic)
|
||||
|
||||
add_subdirectory(ExportLanguages)
|
||||
|
||||
add_subdirectory(Transitive)
|
||||
|
||||
12
Tests/ObjectLibrary/Transitive/CMakeLists.txt
Normal file
12
Tests/ObjectLibrary/Transitive/CMakeLists.txt
Normal file
@@ -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)
|
||||
4
Tests/ObjectLibrary/Transitive/FooObject.c
Normal file
4
Tests/ObjectLibrary/Transitive/FooObject.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int FooObject(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
4
Tests/ObjectLibrary/Transitive/FooStatic.c
Normal file
4
Tests/ObjectLibrary/Transitive/FooStatic.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int FooStatic(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
7
Tests/ObjectLibrary/Transitive/Transitive.c
Normal file
7
Tests/ObjectLibrary/Transitive/Transitive.c
Normal file
@@ -0,0 +1,7 @@
|
||||
extern int FooObject(void);
|
||||
extern int FooStatic(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return FooObject() + FooStatic();
|
||||
}
|
||||
@@ -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$",
|
||||
|
||||
@@ -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$",
|
||||
|
||||
Reference in New Issue
Block a user