From d0c06bcd9346df37c1dd589dec50d9cf8ba960af Mon Sep 17 00:00:00 2001 From: Arfrever Date: Wed, 23 Feb 2022 00:53:14 +0100 Subject: [PATCH] cmake: Set correct sonames for libprotobuf-lite.so and libprotoc.so (#9529) Soname was set for libprotobuf.so in commit a9cf69a0ed7766f56976e48a0c96300e94433511, but similar changes for libprotobuf-lite.so and libprotoc.so were missed. Fixes: #8635 Co-authored-by: Arfrever Frehtes Taifersar Arahesis --- cmake/libprotobuf-lite.cmake | 1 + cmake/libprotobuf.cmake | 1 - cmake/libprotoc.cmake | 1 + update_version.py | 16 +++++++++++----- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake index 5e98748f60..b915f1f1d9 100644 --- a/cmake/libprotobuf-lite.cmake +++ b/cmake/libprotobuf-lite.cmake @@ -108,6 +108,7 @@ if(protobuf_BUILD_SHARED_LIBS) endif() set_target_properties(libprotobuf-lite PROPERTIES VERSION ${protobuf_VERSION} + SOVERSION 30 OUTPUT_NAME ${LIB_PREFIX}protobuf-lite DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index ef5a3cf593..a9a0aef607 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -125,7 +125,6 @@ if(protobuf_BUILD_SHARED_LIBS) endif() set_target_properties(libprotobuf PROPERTIES VERSION ${protobuf_VERSION} - # Use only the first SO version component for compatibility with Makefile emitted SONAME. SOVERSION 30 OUTPUT_NAME ${LIB_PREFIX}protobuf DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake index ed20f31c75..4b967b2a2d 100644 --- a/cmake/libprotoc.cmake +++ b/cmake/libprotoc.cmake @@ -140,6 +140,7 @@ endif() set_target_properties(libprotoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS VERSION ${protobuf_VERSION} + SOVERSION 30 OUTPUT_NAME ${LIB_PREFIX}protoc DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") add_library(protobuf::libprotoc ALIAS libprotoc) diff --git a/update_version.py b/update_version.py index 6e89555c87..61cf7e837e 100755 --- a/update_version.py +++ b/update_version.py @@ -103,11 +103,17 @@ def RewriteTextFile(filename, line_rewriter): def UpdateCMake(): - RewriteTextFile('cmake/libprotobuf.cmake', - lambda line : re.sub( - r'SOVERSION [0-9]+\.[0-9]+(\.[0-9]+)?', - 'SOVERSION %s' % GetSharedObjectVersion()[0], - line)) + cmake_files = ( + 'cmake/libprotobuf.cmake', + 'cmake/libprotobuf-lite.cmake', + 'cmake/libprotoc.cmake' + ) + 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():