From 13ebb377c6ad763ca61d12dd6f88b1126bd0b911 Mon Sep 17 00:00:00 2001 From: Paul Wankadia Date: Fri, 26 Mar 2021 05:20:20 -0700 Subject: [PATCH] Set "compatibility version" and "current version". For #304. Change-Id: I74e2720ecad9a0b22e8cd73dbffe2e02599827c5 Reviewed-on: https://code-review.googlesource.com/c/re2/+/58450 Reviewed-by: Paul Wankadia --- CMakeLists.txt | 7 ++++++- Makefile | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed5ef1360..a1ef60d59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,10 @@ option(USEPCRE "use PCRE in tests and benchmarks" OFF) # so we provide an option similar to BUILD_TESTING, but just for RE2. option(RE2_BUILD_TESTING "enable testing for RE2" ON) +# ABI version +# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html +set(SONAME 9) + set(EXTRA_TARGET_LINK_LIBRARIES) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") @@ -82,7 +86,8 @@ set(RE2_SOURCES ) add_library(re2 ${RE2_SOURCES}) -target_include_directories (re2 PUBLIC $) +target_include_directories(re2 PUBLIC $) +set_target_properties(re2 PROPERTIES SOVERSION ${SONAME} VERSION ${SONAME}.0.0) add_library(re2::re2 ALIAS re2) if(RE2_BUILD_TESTING) diff --git a/Makefile b/Makefile index 44cedeeb5..ba5e4f6e5 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ ifeq ($(shell uname),Darwin) SOEXT=dylib SOEXTVER=$(SONAME).$(SOEXT) SOEXTVER00=$(SONAME).0.0.$(SOEXT) -MAKE_SHARED_LIBRARY=$(CXX) -dynamiclib -Wl,-install_name,$(libdir)/libre2.$(SOEXTVER),-exported_symbols_list,libre2.symbols.darwin $(RE2_LDFLAGS) $(LDFLAGS) +MAKE_SHARED_LIBRARY=$(CXX) -dynamiclib -Wl,-compatibility_version,$(SONAME),-current_version,$(SONAME).0.0,-install_name,$(libdir)/libre2.$(SOEXTVER),-exported_symbols_list,libre2.symbols.darwin $(RE2_LDFLAGS) $(LDFLAGS) else ifeq ($(shell uname),SunOS) SOEXT=so SOEXTVER=$(SOEXT).$(SONAME)