From b87a889d98e419e51a8bda5665cf335409735ca8 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Sun, 10 Oct 2021 18:35:20 +0200 Subject: [PATCH] build(cmake): add version and soversion to the library This adds versioning information to the built library. When building the shared library on Linux systems, a new object will be created: libdynarmic.so.5 This is really useful when talking about ABI compatibility. The variables dynarmic_VERSION and dynarmic_VERSION_MAJOR are implicitly created when calling project(dynarmic VERSION x.y.z) --- CMakeLists.txt | 2 +- src/dynarmic/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a044fbb9..ff98e034 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(dynarmic C CXX ASM) +project(dynarmic LANGUAGES C CXX ASM VERSION 5) # Determine if we're built as a subproject (using add_subdirectory) # or if this is the master project. diff --git a/src/dynarmic/CMakeLists.txt b/src/dynarmic/CMakeLists.txt index fb73efba..902ac614 100644 --- a/src/dynarmic/CMakeLists.txt +++ b/src/dynarmic/CMakeLists.txt @@ -364,6 +364,10 @@ include(CreateDirectoryGroups) create_target_directory_groups(dynarmic) target_include_directories(dynarmic PUBLIC ..) +set_target_properties(dynarmic PROPERTIES + VERSION ${dynarmic_VERSION} + SOVERSION ${dynarmic_VERSION_MAJOR} +) target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS}) target_link_libraries(dynarmic PUBLIC