This commit is contained in:
Jim Derry 2021-07-10 13:26:25 -04:00
parent 97e4177218
commit b22e301226

View file

@ -54,6 +54,7 @@ if (LIBTIDY_VERSION)
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION) list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
list(GET VERSION_LIST 1 TIDY_MINOR_VERSION) list(GET VERSION_LIST 1 TIDY_MINOR_VERSION)
list(GET VERSION_LIST 2 TIDY_POINT_VERSION) list(GET VERSION_LIST 2 TIDY_POINT_VERSION)
set(TIDY_SO_VERSION "${TIDY_MAJOR_VERSION}${TIDY_MINOR_VERSION}")
else () else ()
message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!") message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!")
endif () endif ()
@ -68,6 +69,21 @@ else ()
message(FATAL_ERROR "*** FAILED to get a DATE from version.txt!") message(FATAL_ERROR "*** FAILED to get a DATE from version.txt!")
endif () endif ()
# Establish SOVERSION. Tidy uses a weird form of semantic versioning,
# wherein even minor versions are stable versions with SONAMEs, and
# odd minor versions are `next` versions that should NOT be released,
# are NOT stable, and should NOT have a valid SONAME.
if (TIDY_SO_VERSION)
math(EXPR NO_SONAME "${TIDY_SO_VERSION} % 2")
if ( NO_SONAME EQUAL 0)
message("-> TIDY_SO_VERSION = ${TIDY_SO_VERSION}. This is an EVEN (stable) release.")
else ()
message("-> TIDY_SO_VERSION = ${TIDY_SO_VERSION}. This is an ODD (development) release.")
endif ()
else ()
message(FATAL_ERROR "*** FAILED to build a TIDY_SO_VERSION!")
endif ()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Library Types and Linking # Library Types and Linking
@ -420,7 +436,8 @@ if (BUILD_SHARED_LIB)
OUTPUT_NAME ${LIB_NAME} ) OUTPUT_NAME ${LIB_NAME} )
set_target_properties( ${name} PROPERTIES set_target_properties( ${name} PROPERTIES
VERSION ${LIBTIDY_VERSION} VERSION ${LIBTIDY_VERSION}
SOVERSION ${TIDY_MAJOR_VERSION} ) SOVERSION ${TIDY_SO_VERSION}
NO_SONAME ${NO_SONAME} )
set_target_properties( ${name} PROPERTIES set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILD_SHARED_LIB -DBUILDING_SHARED_LIB") COMPILE_FLAGS "-DBUILD_SHARED_LIB -DBUILDING_SHARED_LIB")
install(TARGETS ${name} install(TARGETS ${name}