CMake: Create symlinks with so version

This commit is contained in:
Maarten Bent
2021-05-27 23:21:24 +02:00
parent f830bde25b
commit 91884752c1
2 changed files with 24 additions and 1 deletions

View File

@@ -46,7 +46,7 @@ set(wxBINARY_DIR ${CMAKE_BINARY_DIR})
set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib)
# parse the version number from wx/version.h and include in wxMAJOR_VERSION and wxMINOR_VERSION
file(READ include/wx/version.h WX_VERSION_H_CONTENTS)
file(READ "${wxSOURCE_DIR}/include/wx/version.h" WX_VERSION_H_CONTENTS)
string(REGEX MATCH "wxMAJOR_VERSION[ \t]+([0-9]+)"
wxMAJOR_VERSION ${WX_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)"
@@ -59,6 +59,7 @@ string(REGEX MATCH "wxRELEASE_NUMBER[ \t]+([0-9]+)"
wxRELEASE_NUMBER ${WX_VERSION_H_CONTENTS})
string (REGEX MATCH "([0-9]+)"
wxRELEASE_NUMBER ${wxRELEASE_NUMBER})
# Determine if current version is a "Development" release
math(EXPR rel_dev "${wxMINOR_VERSION} % 2")
if(rel_dev)
@@ -67,6 +68,23 @@ else()
set(wxVERSION_IS_DEV FALSE)
endif()
# parse the .so version from build/bakefiles/version.bkl
file(READ "${wxSOURCE_DIR}/build/bakefiles/version.bkl" WX_VERSION_BKL_CONTENTS)
string(REGEX MATCH "WX_CURRENT.>([0-9]+)"
WX_CURRENT ${WX_VERSION_BKL_CONTENTS})
string(REGEX MATCH "([0-9]+)"
WX_CURRENT ${WX_CURRENT})
string(REGEX MATCH "WX_REVISION.>([0-9]+)"
WX_REVISION ${WX_VERSION_BKL_CONTENTS})
string(REGEX MATCH "([0-9]+)"
WX_REVISION ${WX_REVISION})
string(REGEX MATCH "WX_AGE.>([0-9]+)"
WX_AGE ${WX_VERSION_BKL_CONTENTS})
string(REGEX MATCH "([0-9]+)"
WX_AGE ${WX_AGE})
math(EXPR wxSOVERSION_MAJOR "${WX_CURRENT} - ${WX_AGE}")
set(wxSOVERSION ${wxSOVERSION_MAJOR}.${WX_AGE}.${WX_REVISION})
set(wxVERSION ${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER})
set(wxCOPYRIGHT "1992-2021 wxWidgets")

View File

@@ -347,6 +347,11 @@ function(wx_set_target_properties target_name is_base)
set_target_properties(${target_name} PROPERTIES FOLDER Libraries)
set_target_properties(${target_name} PROPERTIES
SOVERSION ${wxSOVERSION_MAJOR}
VERSION ${wxSOVERSION}
)
wx_set_common_target_properties(${target_name})
endfunction()