cmake: add a possibility to set library version
authorFelix Fietkau <nbd@nbd.name>
Mon, 15 Feb 2021 18:11:58 +0000 (19:11 +0100)
committerPetr Štetiar <ynezz@true.cz>
Thu, 3 Jun 2021 09:44:59 +0000 (11:44 +0200)
Add a new `ABIVERSION` define which allows to control the SOVERSION used
for the built shared library. This is needed for downstream packaging to
properly track breaking ABI changes when updating to newer versions of
the library.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 2537be01858710e714c329153760c64fe3f8a73e)

CMakeLists.txt

index 5c0f760d031cb2bc875b36e2c1ab6751cc927d4b..ce7cc3ff6ba51a6ee1d73e9d5b827e06524d6686 100644 (file)
@@ -68,6 +68,10 @@ IF(UNIT_TESTING)
   ADD_UNIT_TEST_SAN(ubusd_main ubusd-san)
 ENDIF()
 
+IF(ABIVERSION)
+       SET_TARGET_PROPERTIES(ubus PROPERTIES VERSION ${ABIVERSION})
+ENDIF()
+
 INSTALL(TARGETS ubus cli
        ARCHIVE DESTINATION lib
        LIBRARY DESTINATION lib