Skip to content

Commit b22e301

Browse files
committed
Fixes #743.
1 parent 97e4177 commit b22e301

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

CMakeLists.txt

+18-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ if (LIBTIDY_VERSION)
5454
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
5555
list(GET VERSION_LIST 1 TIDY_MINOR_VERSION)
5656
list(GET VERSION_LIST 2 TIDY_POINT_VERSION)
57+
set(TIDY_SO_VERSION "${TIDY_MAJOR_VERSION}${TIDY_MINOR_VERSION}")
5758
else ()
5859
message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!")
5960
endif ()
@@ -68,6 +69,21 @@ else ()
6869
message(FATAL_ERROR "*** FAILED to get a DATE from version.txt!")
6970
endif ()
7071

72+
# Establish SOVERSION. Tidy uses a weird form of semantic versioning,
73+
# wherein even minor versions are stable versions with SONAMEs, and
74+
# odd minor versions are `next` versions that should NOT be released,
75+
# are NOT stable, and should NOT have a valid SONAME.
76+
if (TIDY_SO_VERSION)
77+
math(EXPR NO_SONAME "${TIDY_SO_VERSION} % 2")
78+
if ( NO_SONAME EQUAL 0)
79+
message("-> TIDY_SO_VERSION = ${TIDY_SO_VERSION}. This is an EVEN (stable) release.")
80+
else ()
81+
message("-> TIDY_SO_VERSION = ${TIDY_SO_VERSION}. This is an ODD (development) release.")
82+
endif ()
83+
else ()
84+
message(FATAL_ERROR "*** FAILED to build a TIDY_SO_VERSION!")
85+
endif ()
86+
7187

7288
#------------------------------------------------------------------------
7389
# Library Types and Linking
@@ -420,7 +436,8 @@ if (BUILD_SHARED_LIB)
420436
OUTPUT_NAME ${LIB_NAME} )
421437
set_target_properties( ${name} PROPERTIES
422438
VERSION ${LIBTIDY_VERSION}
423-
SOVERSION ${TIDY_MAJOR_VERSION} )
439+
SOVERSION ${TIDY_SO_VERSION}
440+
NO_SONAME ${NO_SONAME} )
424441
set_target_properties( ${name} PROPERTIES
425442
COMPILE_FLAGS "-DBUILD_SHARED_LIB -DBUILDING_SHARED_LIB")
426443
install(TARGETS ${name}

0 commit comments

Comments
 (0)