mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
cmake: fix .so versioning
libtool uses -version-info current:revision:age, but the library created is [c-a].a.r. Change-Id: Icf081e156a818a3cd7579ad5ffe3b518d8532bdb
This commit is contained in:
parent
25ae67b3de
commit
5651a6b2ed
@ -317,10 +317,10 @@ ${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h")
|
||||
configure_pkg_config("src/demux/libwebpdemux.pc")
|
||||
|
||||
# Set the version numbers.
|
||||
function(parse_version FILE NAME VAR)
|
||||
macro(set_version FILE TARGET_NAME NAME_IN_MAKEFILE)
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/${FILE} SOURCE_FILE)
|
||||
string(REGEX MATCH
|
||||
"${NAME}_la_LDFLAGS[^\n]* -version-info [0-9:]+"
|
||||
"${NAME_IN_MAKEFILE}_la_LDFLAGS[^\n]* -version-info [0-9:]+"
|
||||
TMP
|
||||
${SOURCE_FILE})
|
||||
string(REGEX MATCH
|
||||
@ -329,29 +329,35 @@ function(parse_version FILE NAME VAR)
|
||||
${TMP})
|
||||
string(REGEX
|
||||
REPLACE ":"
|
||||
"."
|
||||
VERSION
|
||||
" "
|
||||
LT_VERSION
|
||||
${TMP})
|
||||
set(${VAR} "${VERSION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
parse_version(Makefile.am webp WEBP_WEBP_SOVERSION)
|
||||
set_target_properties(webp
|
||||
PROPERTIES VERSION
|
||||
${PACKAGE_VERSION}
|
||||
SOVERSION
|
||||
${WEBP_WEBP_SOVERSION})
|
||||
parse_version(Makefile.am webpdecoder WEBP_DECODER_SOVERSION)
|
||||
set_target_properties(webpdecoder
|
||||
PROPERTIES VERSION
|
||||
${PACKAGE_VERSION}
|
||||
SOVERSION
|
||||
${WEBP_DECODER_SOVERSION})
|
||||
parse_version(demux/Makefile.am webpdemux WEBP_DEMUX_SOVERSION)
|
||||
set_target_properties(webpdemux
|
||||
PROPERTIES VERSION
|
||||
${PACKAGE_VERSION}
|
||||
SOVERSION
|
||||
${WEBP_DEMUX_SOVERSION})
|
||||
|
||||
# See the libtool docs for more information:
|
||||
# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
|
||||
#
|
||||
# c=<current>, a=<age>, r=<revision>
|
||||
#
|
||||
# libtool generates a .so file as .so.[c-a].a.r, while -version-info c:r:a is
|
||||
# passed to libtool.
|
||||
#
|
||||
# We set FULL = [c-a].a.r and MAJOR = [c-a].
|
||||
separate_arguments(LT_VERSION)
|
||||
list(GET LT_VERSION 0 LT_CURRENT)
|
||||
list(GET LT_VERSION 1 LT_REVISION)
|
||||
list(GET LT_VERSION 2 LT_AGE)
|
||||
math(EXPR LT_CURRENT_MINUS_AGE "${LT_CURRENT} - ${LT_AGE}")
|
||||
|
||||
set_target_properties(
|
||||
${TARGET_NAME}
|
||||
PROPERTIES VERSION
|
||||
${LT_CURRENT_MINUS_AGE}.${LT_AGE}.${LT_REVISION}
|
||||
SOVERSION
|
||||
${LT_CURRENT_MINUS_AGE})
|
||||
endmacro()
|
||||
set_version(Makefile.am webp webp)
|
||||
set_version(Makefile.am webpdecoder webpdecoder)
|
||||
set_version(demux/Makefile.am webpdemux webpdemux)
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_FILE)
|
||||
string(REGEX MATCH
|
||||
"AC_INIT\\([^\n]*\\[[0-9\\.]+\\]"
|
||||
@ -458,12 +464,7 @@ if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP)
|
||||
target_include_directories(libwebpmux
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
parse_version(mux/Makefile.am webpmux WEBP_MUX_SOVERSION)
|
||||
set_target_properties(libwebpmux
|
||||
PROPERTIES VERSION
|
||||
${PACKAGE_VERSION}
|
||||
SOVERSION
|
||||
${WEBP_MUX_SOVERSION})
|
||||
set_version(mux/Makefile.am libwebpmux webpmux)
|
||||
set_target_properties(libwebpmux
|
||||
PROPERTIES PUBLIC_HEADER
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
|
||||
|
Loading…
Reference in New Issue
Block a user