1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 19:29:53 +03:00
aports/testing/persistent-cache-cpp/0001-src-core-Add-library-versioning.patch
2024-02-06 18:29:51 +00:00

74 lines
2.3 KiB
Diff

From 31fb33ab9cfed42cf28ec012049b178109cfa9fe Mon Sep 17 00:00:00 2001
From: OPNA2608 <opna2608@protonmail.com>
Date: Wed, 31 Jan 2024 12:01:27 +0100
Subject: [PATCH] src/core: Add library versioning
---
CMakeLists.txt | 9 ++-------
data/libpersistent-cache-cpp.pc.in | 2 +-
src/core/CMakeLists.txt | 8 ++++++++
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98b6bec..ea76225 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,11 @@
-cmake_minimum_required(VERSION 2.8.11)
+cmake_minimum_required(VERSION 3.0)
# Default install location. Must be set here, before setting the project.
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "" FORCE)
endif()
-project(persistent-cache-cpp C CXX)
+project(persistent-cache-cpp VERSION 1.0.7 LANGUAGES C CXX)
option(BUILD_SHARED_LIBS "Build library as shared" OFF)
@@ -13,11 +13,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(LIBNAME persistent-cache-cpp)
-set(VERSION_MAJOR 1)
-set(VERSION_MINOR 0)
-set(VERSION_MICRO 7)
-set(LIBVERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}")
-
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lower case
set(ACCEPTED_BUILD_TYPES "" none release debug relwithdebinfo coverage)
diff --git a/data/libpersistent-cache-cpp.pc.in b/data/libpersistent-cache-cpp.pc.in
index 565a209..fbe8445 100644
--- a/data/libpersistent-cache-cpp.pc.in
+++ b/data/libpersistent-cache-cpp.pc.in
@@ -4,6 +4,6 @@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
Name: lib@LIBNAME@
Description: Cache of key-value pairs with persistent storage for C++
-Version: @LIBVERSION@
+Version: @PROJECT_VERSION@
Libs: -L${libdir} -l@LIBNAME@ @PROPAGATED_LINK_FLAGS@
Cflags: -I${includedir}
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 62b4b7a..e1fc94c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -11,5 +11,13 @@ set(CACHE_SRC
add_library(${LIBNAME} ${CACHE_SRC})
target_link_libraries(${LIBNAME} ${LEVELDB})
+set_target_properties(
+ ${LIBNAME}
+
+ PROPERTIES
+ VERSION "${PROJECT_VERSION}"
+ SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
+)
+
install(TARGETS ${LIBNAME}
DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE})
--
2.43.0