diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-11-24 16:20:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-01 14:24:24 (GMT) |
commit | dfb6e84082884f908ffad4594d2712d9edfd2cc0 (patch) | |
tree | d553ea3a982588c523bc34115f19cbeebe34a74c /Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake | |
parent | 51249e69eaab33fe43805b9fe2262b4ddab01b56 (diff) | |
download | CMake-dfb6e84082884f908ffad4594d2712d9edfd2cc0.zip CMake-dfb6e84082884f908ffad4594d2712d9edfd2cc0.tar.gz CMake-dfb6e84082884f908ffad4594d2712d9edfd2cc0.tar.bz2 |
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
Diffstat (limited to 'Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake')
-rw-r--r-- | Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake new file mode 100644 index 0000000..b9030b3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake @@ -0,0 +1,13 @@ +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) |