Files
CMake/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake
Deniz Bahadir dfb6e84082 objlib: Allow other libraries to link to OBJECT libraries.
Note: This only allows `OBJECT` libraries to be on the right-hand side
of `target_link_libraries` but still does not link its object-files to
the target on the left-hand side.

Issue: #14778
2018-03-01 09:24:24 -05:00

14 lines
375 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_OBJECTS:AnObjLib>)
target_link_libraries(A PUBLIC AnObjLib)
add_executable(exe exe.c)
target_link_libraries(exe A)