| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | --- a/CMakeLists.txt |
| 2 | +++ b/CMakeLists.txt |
| 3 | @@ -28,8 +28,8 @@ set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_ |
| 4 | set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_3}) |
| 5 | set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) |
| 6 | |
| 7 | -# Helper function to get version-info |
| 8 | -function(get_version_info result current_var_name age_var_name revision_var_name) |
| 9 | +# Helper function to get library versions |
| 10 | +function(get_lib_versions version_result soversion_result current_var_name age_var_name revision_var_name) |
| 11 | string(REGEX MATCH "${current_var_name}=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS}) |
| 12 | set(VERSION_INFO_CURRENT ${CMAKE_MATCH_1}) |
| 13 | |
| 14 | @@ -41,7 +41,8 @@ function(get_version_info result current |
| 15 | |
| 16 | math(EXPR VERSION_INFO_CURRENT_MINUS_AGE "${VERSION_INFO_CURRENT} - ${VERSION_INFO_AGE}") |
| 17 | |
| 18 | - set(${result} "${VERSION_INFO_CURRENT_MINUS_AGE}.${VERSION_INFO_AGE}.${VERSION_INFO_REVISION}" PARENT_SCOPE) |
| 19 | + set(${version_result} "${VERSION_INFO_CURRENT_MINUS_AGE}.${VERSION_INFO_AGE}.${VERSION_INFO_REVISION}" PARENT_SCOPE) |
| 20 | + set(${soversion_result} "${VERSION_INFO_CURRENT_MINUS_AGE}" PARENT_SCOPE) |
| 21 | endfunction() |
| 22 | |
| 23 | # Helper function to configure pkg-config files |
| 24 | --- a/lib/CMakeLists.txt |
| 25 | +++ b/lib/CMakeLists.txt |
| 26 | @@ -78,12 +78,12 @@ if (NOT BUILD_FRAMEWORK) |
| 27 | add_library(vorbisenc ${VORBISENC_SOURCES}) |
| 28 | add_library(vorbisfile ${VORBISFILE_SOURCES}) |
| 29 | |
| 30 | - get_version_info(VORBIS_VERSION_INFO "V_LIB_CURRENT" "V_LIB_AGE" "V_LIB_REVISION") |
| 31 | - set_target_properties(vorbis PROPERTIES SOVERSION ${VORBIS_VERSION_INFO}) |
| 32 | - get_version_info(VORBISENC_VERSION_INFO "VE_LIB_CURRENT" "VE_LIB_AGE" "VE_LIB_REVISION") |
| 33 | - set_target_properties(vorbisenc PROPERTIES SOVERSION ${VORBISENC_VERSION_INFO}) |
| 34 | - get_version_info(VORBISFILE_VERSION_INFO "VF_LIB_CURRENT" "VF_LIB_AGE" "VF_LIB_REVISION") |
| 35 | - set_target_properties(vorbisfile PROPERTIES SOVERSION ${VORBISFILE_VERSION_INFO}) |
| 36 | + get_lib_versions(VORBIS_VERSION VORBIS_SOVERSION "V_LIB_CURRENT" "V_LIB_AGE" "V_LIB_REVISION") |
| 37 | + set_target_properties(vorbis PROPERTIES VERSION ${VORBIS_VERSION} SOVERSION ${VORBIS_SOVERSION}) |
| 38 | + get_lib_versions(VORBISENC_VERSION VORBISENC_SOVERSION "VE_LIB_CURRENT" "VE_LIB_AGE" "VE_LIB_REVISION") |
| 39 | + set_target_properties(vorbisenc PROPERTIES VERSION ${VORBISENC_VERSION} SOVERSION ${VORBISENC_SOVERSION}) |
| 40 | + get_lib_versions(VORBISFILE_VERSION VORBISFILE_SOVERSION "VF_LIB_CURRENT" "VF_LIB_AGE" "VF_LIB_REVISION") |
| 41 | + set_target_properties(vorbisfile PROPERTIES VERSION ${VORBISFILE_VERSION} SOVERSION ${VORBISFILE_SOVERSION}) |
| 42 | |
| 43 | target_include_directories(vorbis |
| 44 | PUBLIC |