Files
CMake/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake
Deniz Bahadir 57538224d0 objlib: Link object-files from OBJECT libraries.
Note: This finally links the object-files of the `OBJECT` library from
the right-hand side of `target_link_libraries` to the target on the
left-hand side. However, this will only happen with directly linked
`OBJECT` libraries, not with `OBJECT` libraries "linked" through
property `INTERFACE_LINK_LIBRARIES` of a target on the right-hand side!

Fixes: #14778
2018-03-01 09:24:25 -05:00

12 lines
332 B
CMake

enable_language(C)
add_library(AnObjLib OBJECT a.c)
target_compile_definitions(AnObjLib INTERFACE REQUIRED)
add_library(A STATIC b.c)
target_link_libraries(A PRIVATE AnObjLib)
target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>)
add_executable(exe exe.c)
target_link_libraries(exe A)