diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-12-03 13:20:14 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-12-15 12:36:25 +0100 |
commit | 5de6848f104d7cb0017080e31216265ac19d0dde (patch) | |
tree | 9c02cd32e584b45c0829669c16a38287537232f8 /lib | |
parent | 614f78131ad7db715ab8279f4a8af9bf0b2b4789 (diff) | |
download | curl-5de6848f104d7cb0017080e31216265ac19d0dde.tar.gz |
cmake: set the soname on the shared library
Set SONAME and VERSION for platforms we think this works on. Remove
issue from KNOWN_BUGS.
Assisted-by: Jakub Zakrzewski
Closes #10023
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CMakeLists.txt | 26 | ||||
-rw-r--r-- | lib/Makefile.am | 17 | ||||
-rw-r--r-- | lib/Makefile.soname | 42 |
3 files changed, 71 insertions, 14 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8cea346c3..5ca5357d9 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -98,11 +98,37 @@ endif() target_link_libraries(${LIB_NAME} PRIVATE ${CURL_LIBS}) +transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake") +include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake) + set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL OUTPUT_NAME ${LIBCURL_OUTPUT_NAME} ) +if(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR + CMAKE_SYSTEM_NAME STREQUAL "Linux" OR + CMAKE_SYSTEM_NAME STREQUAL "GNU/kFreeBSD" OR + + # FreeBSD comes with the a.out and elf flavours + # but a.out was supported up to version 3.x and + # elf from 3.x. I cannot imagine someone runnig + # CMake on those ancient systems + CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR + + CMAKE_SYSTEM_NAME STREQUAL "Haiku") + + math(EXPR CMAKESONAME "${VERSIONCHANGE} - ${VERSIONDEL}") + set(CMAKEVERSION "${CMAKESONAME}.${VERSIONDEL}.${VERSIONADD}") + + set_target_properties(${LIB_NAME} PROPERTIES + VERSION ${CMAKEVERSION} + SOVERSION ${CMAKESONAME} + ) + +endif() + + if(HIDES_CURL_PRIVATE_SYMBOLS) set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS") set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_FLAGS ${CURL_CFLAG_SYMBOLS_HIDE}) diff --git a/lib/Makefile.am b/lib/Makefile.am index e74ce1f0d..033b4bf10 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -28,7 +28,8 @@ CMAKE_DIST = CMakeLists.txt curl_config.h.cmake EXTRA_DIST = Makefile.mk config-win32.h config-win32ce.h config-plan9.h \ config-riscos.h config-mac.h curl_config.h.in config-dos.h \ libcurl.plist libcurl.rc config-amigaos.h config-win32ce.h \ - config-os400.h setup-os400.h $(CMAKE_DIST) setup-win32.h .checksrc + config-os400.h setup-os400.h $(CMAKE_DIST) setup-win32.h .checksrc \ + Makefile.soname lib_LTLIBRARIES = libcurl.la @@ -57,19 +58,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ # Prevent LIBS from being used for all link targets LIBS = $(BLANK_AT_MAKETIME) -VERSIONINFO=-version-info 12:0:8 -# This flag accepts an argument of the form current[:revision[:age]]. So, -# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to -# 1. -# -# Here's the simplified rule guide on how to change -version-info: -# (current version is C:R:A) -# -# 1. if there are only source changes, use C:R+1:A -# 2. if interfaces were added use C+1:0:A+1 -# 3. if interfaces were removed, then use C+1:0:0 -# -# For the full guide on libcurl ABI rules, see docs/libcurl/ABI +include Makefile.soname AM_CPPFLAGS += -DBUILDING_LIBCURL AM_LDFLAGS = diff --git a/lib/Makefile.soname b/lib/Makefile.soname new file mode 100644 index 000000000..2c6cfdea6 --- /dev/null +++ b/lib/Makefile.soname @@ -0,0 +1,42 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# SPDX-License-Identifier: curl +# +########################################################################### + +VERSIONCHANGE=12 +VERSIONADD=0 +VERSIONDEL=8 + +# libtool version: +VERSIONINFO=-version-info $(VERSIONCHANGE):$(VERSIONADD):$(VERSIONDEL) +# This flag accepts an argument of the form current[:revision[:age]]. So, +# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to +# 1. +# +# Here's the simplified rule guide on how to change -version-info: +# (current version is C:R:A) +# +# 1. if there are only source changes, use C:R+1:A +# 2. if interfaces were added use C+1:0:A+1 +# 3. if interfaces were removed, then use C+1:0:0 +# +# For the full guide on libcurl ABI rules, see docs/libcurl/ABI |