alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.1k stars 311 forks source link

Add SOVERSION to shared library #393

Closed badshah400 closed 4 months ago

badshah400 commented 4 months ago

Feature category

The problem This is a request to add an SOVERSION to the shared library libmatplot that may only be incremented to indicate breakage or interface changes. According to TLDP,

Every shared library has a special name called the "soname''. The soname has the prefix "lib'', the name of the library, the phrase ".so'', followed by a period and a version number that is incremented whenever the interface changes

The solution I'd like

Ideally the soversion will be the major version, i.e. 1 for matplot++ 1.2.x. This patch does it:

Index: matplotplusplus-1.2.1/source/matplot/CMakeLists.txt
===================================================================
--- matplotplusplus-1.2.1.orig/source/matplot/CMakeLists.txt
+++ matplotplusplus-1.2.1/source/matplot/CMakeLists.txt
@@ -98,7 +98,7 @@ target_include_directories(matplot
     PUBLIC $<BUILD_INTERFACE:${MATPLOT_ROOT_DIR}/source>
            $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

-set_target_properties(matplot PROPERTIES VERSION ${PROJECT_VERSION})
+set_target_properties(matplot PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})

 # Shared library symbol export
 include(GenerateExportHeader)

Alternatives I've considered

NA

Additional context

I am a packager for openSUSE and am working on submitting matplot++ packages to the distro's official repository.

Thanks a lot for your very useful library.

alandefreitas commented 4 months ago

Thanks for the issue. Yes. This makes sense.