diff options
author | Damjan Marion <damarion@cisco.com> | 2021-04-02 17:35:13 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2021-04-02 17:38:54 +0200 |
commit | 115012a0b1d9617c07bae5c82a19125b3c692258 (patch) | |
tree | 033e257779e2ca88c057d2647c8f3ababb7406ea /src | |
parent | a77ae4708906b2a7894f7ac694bf55d5f0558d5f (diff) |
build: create _objs target for each library
Type: improvement
Change-Id: I260580cf2d32ff949f44d80c764937ee6102486c
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cmake/library.cmake | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake index fdd34691a12..37239f3d680 100644 --- a/src/cmake/library.cmake +++ b/src/cmake/library.cmake @@ -19,7 +19,13 @@ macro(add_vpp_library lib) ${ARGN} ) - add_library(${lib} SHARED ${ARG_SOURCES}) + set (lo ${lib}_objs) + add_library(${lo} OBJECT ${ARG_SOURCES}) + set_target_properties(${lo} PROPERTIES POSITION_INDEPENDENT_CODE ON) + + add_library(${lib} SHARED) + target_sources(${lib} PRIVATE $<TARGET_OBJECTS:${lo}>) + if(VPP_LIB_VERSION) set_target_properties(${lib} PROPERTIES SOVERSION ${VPP_LIB_VERSION}) endif() @@ -39,6 +45,7 @@ macro(add_vpp_library lib) ) if (ARG_LTO AND VPP_USE_LTO) + set_property(TARGET ${lo} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) set_property(TARGET ${lib} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) target_compile_options (${lib} PRIVATE "-ffunction-sections") target_compile_options (${lib} PRIVATE "-fdata-sections") @@ -66,11 +73,11 @@ macro(add_vpp_library lib) endif() if(NOT VPP_EXTERNAL_PROJECT) - add_dependencies(${lib} api_headers) + add_dependencies(${lo} api_headers) endif() if(ARG_DEPENDS) - add_dependencies(${lib} ${ARG_DEPENDS}) + add_dependencies(${lo} ${ARG_DEPENDS}) endif() # install headers |