From ba1a770bdbeecff0312c3a0ecc9a70649b989c9d Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Fri, 6 Sep 2019 10:02:00 +0200 Subject: [PATCH] build: add cmake library VERSION, SOVERSION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This mimics the behavior of the automake build, using libuv.so.${UV_VERSION_MAJOR}.0.0 as the output file, and setting the soname property to be libuv.so.${UV_VERSION_MAJOR}, currently ending up like this: libuv.so.1.0.0 libuv.so.1 -> libuv.so.1.0.0 libuv.so -> libuv.so.1 The version information is extracted from the PACKAGE_VERSION string. PR-URL: https://github.com/libuv/libuv/pull/2445 Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé Signed-off-by: Eneas U de Queiroz --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b4cccd6e..9ecaaeded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -386,6 +386,10 @@ if(UNIX) endforeach(x) file(STRINGS configure.ac configure_ac REGEX ^AC_INIT) string(REGEX MATCH [0-9]+[.][0-9]+[.][0-9]+ PACKAGE_VERSION "${configure_ac}") + string(REGEX MATCH ^[0-9]+ UV_VERSION_MAJOR "${PACKAGE_VERSION}") + # The version in the filename is mirroring the behaviour of autotools. + set_target_properties(uv PROPERTIES VERSION ${UV_VERSION_MAJOR}.0.0 + SOVERSION ${UV_VERSION_MAJOR}) set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) set(prefix ${CMAKE_INSTALL_PREFIX})