Skip to content

Commit d06b827

Browse files
Abseil Teamcopybara-github
authored andcommitted
Move SOVERSION to global CMakeLists, apply SOVERSION to DLL
So that multiple LTS builds can co-exist. PiperOrigin-RevId: 639154515 Change-Id: Id34d6fbef823151a4f3c73cf7b9b340257eadd63
1 parent 0d9746a commit d06b827

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

CMake/AbseilDll.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,10 @@ function(absl_make_dll)
827827
${_dll_libs}
828828
${ABSL_DEFAULT_LINKOPTS}
829829
)
830-
set_property(TARGET ${_dll} PROPERTY LINKER_LANGUAGE "CXX")
830+
set_target_properties(${_dll} PROPERTIES
831+
LINKER_LANGUAGE "CXX"
832+
SOVERSION ${ABSL_SOVERSION}
833+
)
831834
target_include_directories(
832835
${_dll}
833836
PUBLIC

CMake/AbseilHelpers.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
306306
if(ABSL_ENABLE_INSTALL)
307307
set_target_properties(${_NAME} PROPERTIES
308308
OUTPUT_NAME "absl_${_NAME}"
309-
SOVERSION 0
309+
SOVERSION "${ABSL_SOVERSION}"
310310
)
311311
endif()
312312
else()

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ if (POLICY CMP0141)
5959
endif (POLICY CMP0141)
6060

6161
project(absl LANGUAGES CXX)
62+
set(ABSL_SOVERSION 0)
6263
include(CTest)
6364

6465
# Output directory is correct by default for most build setups. However, when

create_lts.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,21 @@ def main(argv):
116116
datestamp)
117117
})
118118
ReplaceStringsInFile(
119-
'CMakeLists.txt', {
120-
'project(absl LANGUAGES CXX)':
119+
'CMakeLists.txt',
120+
{
121+
'project(absl LANGUAGES CXX)': (
121122
'project(absl LANGUAGES CXX VERSION {})'.format(datestamp)
122-
})
123-
# Set the SOVERSION to YYMM.0.0 - The first 0 means we only have ABI
124-
# compatible changes, and the second 0 means we can increment it to
125-
# mark changes as ABI-compatible, for patch releases. Note that we
126-
# only use the last two digits of the year and the month because the
127-
# MacOS linker requires the first part of the SOVERSION to fit into
128-
# 16 bits.
129-
# https://www.sicpers.info/2013/03/how-to-version-a-mach-o-library/
130-
ReplaceStringsInFile(
131-
'CMake/AbseilHelpers.cmake',
132-
{'SOVERSION 0': 'SOVERSION "{}.0.0"'.format(datestamp[2:6])})
123+
),
124+
# Set the SOVERSION to YYMM.0.0 - The first 0 means we only have ABI
125+
# compatible changes, and the second 0 means we can increment it to
126+
# mark changes as ABI-compatible, for patch releases. Note that we
127+
# only use the last two digits of the year and the month because the
128+
# MacOS linker requires the first part of the SOVERSION to fit into
129+
# 16 bits.
130+
# https://www.sicpers.info/2013/03/how-to-version-a-mach-o-library/
131+
'ABSL_SOVERSION 0': 'ABSL_SOVERSION "{}.0.0"'.format(datestamp[2:6]),
132+
},
133+
)
133134
StripContentBetweenTags('CMakeLists.txt', '# absl:lts-remove-begin',
134135
'# absl:lts-remove-end')
135136

0 commit comments

Comments
 (0)