Skip to content

Commit dc1e76d

Browse files
authored
Introduce SOVERSION for ABI compatibility (#771)
This commit sets the library's SOVERSION to its major version number. Setting the soname this way establishes a clear ABI promise. This allows users to safely upgrade to minor or patch releases without needing to recompile their applications, as long as the major version remains the same.
1 parent 6c073b2 commit dc1e76d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ if(NOT ADS_VERSION)
1616
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}")
1717
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
1818
set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
19+
set(VERSION_SONAME "${VERSION_MAJOR}")
1920
else()
2021
string(REGEX MATCHALL "[\.]" VERSION_DOT_MATCHES ${ADS_VERSION})
2122
list(LENGTH VERSION_DOT_MATCHES VERSION_DOT_COUNT)
2223
if(VERSION_DOT_COUNT EQUAL 2)
2324
set(VERSION_SHORT ${ADS_VERSION})
25+
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_SONAME "${ADS_VERSION}")
2426
else()
2527
message(FATAL_ERROR "ADS_VERSION must be in major.minor.patch format, e.g. 3.8.1. Got ${ADS_VERSION}")
2628
endif()

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ set_target_properties(${library_name} PROPERTIES
109109
AUTORCC ON
110110
CXX_EXTENSIONS OFF
111111
VERSION ${VERSION_SHORT}
112+
SOVERSION ${VERSION_SONAME}
112113
EXPORT_NAME ${library_name}
113114
DEBUG_POSTFIX "d"
114115
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"

0 commit comments

Comments
 (0)