cmake: Set correct sonames for libprotobuf-lite.so and libprotoc.so (#9529)

Soname was set for libprotobuf.so in commit a9cf69a0ed,
but similar changes for libprotobuf-lite.so and libprotoc.so were missed.

Fixes: #8635

Co-authored-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@GMail.Com>
This commit is contained in:
Arfrever 2022-02-23 00:53:14 +01:00 committed by GitHub
parent db56692883
commit d0c06bcd93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -108,6 +108,7 @@ if(protobuf_BUILD_SHARED_LIBS)
endif() endif()
set_target_properties(libprotobuf-lite PROPERTIES set_target_properties(libprotobuf-lite PROPERTIES
VERSION ${protobuf_VERSION} VERSION ${protobuf_VERSION}
SOVERSION 30
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)

View File

@ -125,7 +125,6 @@ if(protobuf_BUILD_SHARED_LIBS)
endif() endif()
set_target_properties(libprotobuf PROPERTIES set_target_properties(libprotobuf PROPERTIES
VERSION ${protobuf_VERSION} VERSION ${protobuf_VERSION}
# Use only the first SO version component for compatibility with Makefile emitted SONAME.
SOVERSION 30 SOVERSION 30
OUTPUT_NAME ${LIB_PREFIX}protobuf OUTPUT_NAME ${LIB_PREFIX}protobuf
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")

View File

@ -140,6 +140,7 @@ endif()
set_target_properties(libprotoc PROPERTIES set_target_properties(libprotoc PROPERTIES
COMPILE_DEFINITIONS LIBPROTOC_EXPORTS COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
VERSION ${protobuf_VERSION} VERSION ${protobuf_VERSION}
SOVERSION 30
OUTPUT_NAME ${LIB_PREFIX}protoc OUTPUT_NAME ${LIB_PREFIX}protoc
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotoc ALIAS libprotoc) add_library(protobuf::libprotoc ALIAS libprotoc)

View File

@ -103,11 +103,17 @@ def RewriteTextFile(filename, line_rewriter):
def UpdateCMake(): def UpdateCMake():
RewriteTextFile('cmake/libprotobuf.cmake', cmake_files = (
lambda line : re.sub( 'cmake/libprotobuf.cmake',
r'SOVERSION [0-9]+\.[0-9]+(\.[0-9]+)?', 'cmake/libprotobuf-lite.cmake',
'SOVERSION %s' % GetSharedObjectVersion()[0], 'cmake/libprotoc.cmake'
line)) )
for cmake_file in cmake_files:
RewriteTextFile(cmake_file,
lambda line : re.sub(
r'SOVERSION [0-9]+\.[0-9]+(\.[0-9]+)?',
'SOVERSION %s' % GetSharedObjectVersion()[0],
line))
def UpdateConfigure(): def UpdateConfigure():