I had a look at the autotools stuff, and I believe this snippet from bin/ltmain.sh
explains it:
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
func_arith $current - $age
major=.$func_arith_result
versuffix=$major.$age.$revision
# Darwin ld doesn't like 0 for these options...
func_arith $current + 1
minor_current=$func_arith_result
xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
# On Darwin other compilers
case $CC in
nagfor*)
verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
;;
*)
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
esac
;;
Libtool doing + 1 here probably explains why you’ve chosen to set LT_VERS_INTERFACE
to 103 on HDF5 1.10.4?
Then maybe the CMake logic should be updated to match the libtool logic, so add 1?
As a side note, I found this snipped just below in config/cmake/HDF5Macros.cmake
:
#-- Apple Specific install_name for libraries
if (APPLE)
option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
if (HDF5_BUILD_WITH_INSTALL_NAME)
set_property(TARGET ${libtarget} APPEND PROPERTY
LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}"
)
set_target_properties (${libtarget} PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
)
endif ()
...
so it seems that currently, one way of working around this discrepancy issue is to make do the CMake build with the HDF5_BUILD_WITH_INSTALL_NAME
option set, because then the CMake scripts will manually pass -compatibility_version ${HDF5_PACKAGE_VERSION}
. Haven’t tested this though, just an observation.