Set the SOVERSION in CMake from MAJOR/MINOR/RELEASE variables

Having the SOVERSION derived from the git tags doesn't scale well
for distributions that don't have the git history while building
(such as a tarball).

As part of 8b96ee5 the strings are parsed from a header.  Re-use
those.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>


[ROCm/amdsmi commit: ccfdb65b6f]
Этот коммит содержится в:
Mario Limonciello
2025-09-16 15:35:05 -05:00
коммит произвёл Arif, Maisam
родитель f20ecc8512
Коммит ef8882b4bf
+2 -17
Просмотреть файл
@@ -59,22 +59,7 @@ endif()
# VERSION_* variables should be set by get_version_from_tag
message("Package version: ${PKG_VERSION_STR}")
# Debian package specific variables
# Set a default value for the package version
get_version_from_tag("${${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR}.${${AMD_SMI_LIBS_TARGET}_VERSION_MINOR}.0.0"
${SO_VERSION_GIT_TAG_PREFIX} GIT)
# VERSION_* variables should be set by get_version_from_tag
if(${ROCM_PATCH_VERSION})
set(VERSION_PATCH ${ROCM_PATCH_VERSION})
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
else()
set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
endif()
set(${AMD_SMI}_VERSION_MAJOR "${VERSION_MAJOR}")
set(${AMD_SMI}_VERSION_MINOR "${VERSION_MINOR}")
set(${AMD_SMI}_VERSION_PATCH "0")
set(${AMD_SMI}_VERSION_BUILD "0")
set(SO_VERSION_STRING "${MAJOR}.${MINOR}.${RELEASE}")
message("SOVERSION: ${SO_VERSION_STRING}")
add_library(${AMD_SMI} ${SRC_LIST} ${INC_LIST})
@@ -97,7 +82,7 @@ target_include_directories(${AMD_SMI} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
## Set the VERSION and SOVERSION values
set_property(TARGET ${AMD_SMI} PROPERTY SOVERSION "${VERSION_MAJOR}")
set_property(TARGET ${AMD_SMI} PROPERTY SOVERSION "${MAJOR}")
set_property(TARGET ${AMD_SMI} PROPERTY VERSION "${SO_VERSION_STRING}")
## If the library is a release, strip the target library