mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-19 23:36:45 +02: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")
|
configure_pkg_config("src/demux/libwebpdemux.pc")
|
||||||
|
|
||||||
# Set the version numbers.
|
# 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)
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/${FILE} SOURCE_FILE)
|
||||||
string(REGEX MATCH
|
string(REGEX MATCH
|
||||||
"${NAME}_la_LDFLAGS[^\n]* -version-info [0-9:]+"
|
"${NAME_IN_MAKEFILE}_la_LDFLAGS[^\n]* -version-info [0-9:]+"
|
||||||
TMP
|
TMP
|
||||||
${SOURCE_FILE})
|
${SOURCE_FILE})
|
||||||
string(REGEX MATCH
|
string(REGEX MATCH
|
||||||
@ -329,29 +329,35 @@ function(parse_version FILE NAME VAR)
|
|||||||
${TMP})
|
${TMP})
|
||||||
string(REGEX
|
string(REGEX
|
||||||
REPLACE ":"
|
REPLACE ":"
|
||||||
"."
|
" "
|
||||||
VERSION
|
LT_VERSION
|
||||||
${TMP})
|
${TMP})
|
||||||
set(${VAR} "${VERSION}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
# See the libtool docs for more information:
|
||||||
parse_version(Makefile.am webp WEBP_WEBP_SOVERSION)
|
# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
|
||||||
set_target_properties(webp
|
#
|
||||||
PROPERTIES VERSION
|
# c=<current>, a=<age>, r=<revision>
|
||||||
${PACKAGE_VERSION}
|
#
|
||||||
SOVERSION
|
# libtool generates a .so file as .so.[c-a].a.r, while -version-info c:r:a is
|
||||||
${WEBP_WEBP_SOVERSION})
|
# passed to libtool.
|
||||||
parse_version(Makefile.am webpdecoder WEBP_DECODER_SOVERSION)
|
#
|
||||||
set_target_properties(webpdecoder
|
# We set FULL = [c-a].a.r and MAJOR = [c-a].
|
||||||
PROPERTIES VERSION
|
separate_arguments(LT_VERSION)
|
||||||
${PACKAGE_VERSION}
|
list(GET LT_VERSION 0 LT_CURRENT)
|
||||||
SOVERSION
|
list(GET LT_VERSION 1 LT_REVISION)
|
||||||
${WEBP_DECODER_SOVERSION})
|
list(GET LT_VERSION 2 LT_AGE)
|
||||||
parse_version(demux/Makefile.am webpdemux WEBP_DEMUX_SOVERSION)
|
math(EXPR LT_CURRENT_MINUS_AGE "${LT_CURRENT} - ${LT_AGE}")
|
||||||
set_target_properties(webpdemux
|
|
||||||
PROPERTIES VERSION
|
set_target_properties(
|
||||||
${PACKAGE_VERSION}
|
${TARGET_NAME}
|
||||||
SOVERSION
|
PROPERTIES VERSION
|
||||||
${WEBP_DEMUX_SOVERSION})
|
${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)
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac CONFIGURE_FILE)
|
||||||
string(REGEX MATCH
|
string(REGEX MATCH
|
||||||
"AC_INIT\\([^\n]*\\[[0-9\\.]+\\]"
|
"AC_INIT\\([^\n]*\\[[0-9\\.]+\\]"
|
||||||
@ -458,12 +464,7 @@ if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP)
|
|||||||
target_include_directories(libwebpmux
|
target_include_directories(libwebpmux
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR})
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
parse_version(mux/Makefile.am webpmux WEBP_MUX_SOVERSION)
|
set_version(mux/Makefile.am libwebpmux webpmux)
|
||||||
set_target_properties(libwebpmux
|
|
||||||
PROPERTIES VERSION
|
|
||||||
${PACKAGE_VERSION}
|
|
||||||
SOVERSION
|
|
||||||
${WEBP_MUX_SOVERSION})
|
|
||||||
set_target_properties(libwebpmux
|
set_target_properties(libwebpmux
|
||||||
PROPERTIES PUBLIC_HEADER
|
PROPERTIES PUBLIC_HEADER
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user