Files
CMake/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.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

15 lines
447 B
CMake

enable_language(C)
add_definitions(-DCOMPILE_FOR_SHARED_LIB)
add_library(AnObjLib OBJECT a.c)
target_compile_definitions(AnObjLib INTERFACE REQUIRED)
set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(A SHARED 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)