1b815c7f3Sopenharmony_ci# Inspiration: https://github.com/ros2-dotnet/Fast-RTPS
2b815c7f3Sopenharmony_ci
3b815c7f3Sopenharmony_cimacro (SETUP_ABI_VERSIONS)
4b815c7f3Sopenharmony_ci
5b815c7f3Sopenharmony_ci    file (STRINGS ${PROJECT_SOURCE_DIR}/configure.ac CONFIGURE_AC_CONTENT)
6b815c7f3Sopenharmony_ci    file (STRINGS
7b815c7f3Sopenharmony_ci        configure.ac
8b815c7f3Sopenharmony_ci        SNDFILE_LT_CURRENT_TMP
9b815c7f3Sopenharmony_ci        REGEX "^m4_define\\(\\[?lt_current\\]?, *\\[?[0-9]+\\]?\\)"
10b815c7f3Sopenharmony_ci        )
11b815c7f3Sopenharmony_ci    string (REGEX REPLACE "m4_define\\(\\[?lt_current\\]?, *\\[?([0-9]+)\\]?\\)"
12b815c7f3Sopenharmony_ci        "\\1"
13b815c7f3Sopenharmony_ci        SNDFILE_LT_CURRENT
14b815c7f3Sopenharmony_ci        ${SNDFILE_LT_CURRENT_TMP}
15b815c7f3Sopenharmony_ci        )
16b815c7f3Sopenharmony_ci
17b815c7f3Sopenharmony_ci    file (STRINGS
18b815c7f3Sopenharmony_ci        configure.ac
19b815c7f3Sopenharmony_ci        SNDFILE_LT_REVISION_TMP
20b815c7f3Sopenharmony_ci        REGEX "^m4_define\\(\\[?lt_revision\\]?, *\\[?[0-9]+\\]?\\)"
21b815c7f3Sopenharmony_ci        )
22b815c7f3Sopenharmony_ci    string (REGEX REPLACE "m4_define\\(\\[?lt_revision\\]?, *\\[?([0-9]+)\\]?\\)"
23b815c7f3Sopenharmony_ci        "\\1"
24b815c7f3Sopenharmony_ci        SNDFILE_LT_REVISION
25b815c7f3Sopenharmony_ci        ${SNDFILE_LT_REVISION_TMP}
26b815c7f3Sopenharmony_ci        )
27b815c7f3Sopenharmony_ci
28b815c7f3Sopenharmony_ci    file (STRINGS
29b815c7f3Sopenharmony_ci        configure.ac
30b815c7f3Sopenharmony_ci        SNDFILE_LT_AGE_TMP
31b815c7f3Sopenharmony_ci        REGEX "^m4_define\\(\\[?lt_age\\]?, *\\[?[0-9]+\\]?\\)"
32b815c7f3Sopenharmony_ci        )
33b815c7f3Sopenharmony_ci    string (REGEX REPLACE "m4_define\\(\\[?lt_age\\]?, *\\[?([0-9]+)\\]?\\)"
34b815c7f3Sopenharmony_ci        "\\1"
35b815c7f3Sopenharmony_ci        SNDFILE_LT_AGE
36b815c7f3Sopenharmony_ci        ${SNDFILE_LT_AGE_TMP}
37b815c7f3Sopenharmony_ci        )
38b815c7f3Sopenharmony_ci
39b815c7f3Sopenharmony_ci    #
40b815c7f3Sopenharmony_ci    # Calculate CMake compatible ABI version from libtool version.
41b815c7f3Sopenharmony_ci    #
42b815c7f3Sopenharmony_ci
43b815c7f3Sopenharmony_ci    math (EXPR SNDFILE_ABI_VERSION_MAJOR "${SNDFILE_LT_CURRENT} - ${SNDFILE_LT_AGE}")
44b815c7f3Sopenharmony_ci    set (SNDFILE_ABI_VERSION_MINOR ${SNDFILE_LT_AGE})
45b815c7f3Sopenharmony_ci    set (SNDFILE_ABI_VERSION_PATCH ${SNDFILE_LT_REVISION})
46b815c7f3Sopenharmony_ci    set (SNDFILE_ABI_VERSION "${SNDFILE_ABI_VERSION_MAJOR}.${SNDFILE_ABI_VERSION_MINOR}.${SNDFILE_ABI_VERSION_PATCH}")
47b815c7f3Sopenharmony_ci
48b815c7f3Sopenharmony_ci    #
49b815c7f3Sopenharmony_ci    # Apple platform current and compatibility versions.
50b815c7f3Sopenharmony_ci    #
51b815c7f3Sopenharmony_ci
52b815c7f3Sopenharmony_ci    math (EXPR SNDFILE_MACHO_CURRENT_VERSION_MAJOR "${SNDFILE_ABI_VERSION_MAJOR} + ${SNDFILE_ABI_VERSION_MINOR} + 1")
53b815c7f3Sopenharmony_ci    set (SNDFILE_MACHO_CURRENT_VERSION "${SNDFILE_MACHO_CURRENT_VERSION_MAJOR}.${SNDFILE_ABI_VERSION_PATCH}.0")
54b815c7f3Sopenharmony_ci    set (SNDFILE_MACHO_COMPATIBILITY_VERSION "${SNDFILE_MACHO_CURRENT_VERSION_MAJOR}.0.0")
55b815c7f3Sopenharmony_ci
56b815c7f3Sopenharmony_ciendmacro (SETUP_ABI_VERSIONS)
57