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