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)
This commit is contained in:
Andrea Pappacoda 2021-10-10 18:35:20 +02:00 committed by merry
parent 55bede81f8
commit b87a889d98
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8) 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) # Determine if we're built as a subproject (using add_subdirectory)
# or if this is the master project. # or if this is the master project.

View file

@ -364,6 +364,10 @@ include(CreateDirectoryGroups)
create_target_directory_groups(dynarmic) create_target_directory_groups(dynarmic)
target_include_directories(dynarmic PUBLIC ..) 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_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
target_link_libraries(dynarmic target_link_libraries(dynarmic
PUBLIC PUBLIC