1# 2# Copyright by The HDF Group. 3# All rights reserved. 4# 5# This file is part of HDF5. The full HDF5 copyright notice, including 6# terms governing use, modification, and redistribution, is contained in 7# the COPYING file, which can be found at the root of the source code 8# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. 9# If you do not have access to either file, you may request a copy from 10# help@hdfgroup.org. 11# 12#------------------------------------------------------------------------------- 13macro (H5_SET_LIB_OPTIONS libtarget libname libtype) 14 set (LIB_OUT_NAME "${libname}") 15 # SOVERSION passed in ARGN when shared 16 if (${libtype} MATCHES "SHARED") 17 if (ARGN) 18 set (PACKAGE_SOVERSION ${ARGN}) 19 else () 20 set (PACKAGE_SOVERSION ${HDF5_PACKAGE_SOVERSION}) 21 endif () 22 if (WIN32) 23 set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) 24 else () 25 set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION}) 26 endif () 27 set_target_properties (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION}) 28 if (WIN32) 29 set (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${PACKAGE_SOVERSION}") 30 else () 31 set_target_properties (${libtarget} PROPERTIES SOVERSION ${PACKAGE_SOVERSION}) 32 endif () 33 endif () 34 HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype}) 35 36 #-- Apple Specific install_name for libraries 37 if (APPLE) 38 option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) 39 if (HDF5_BUILD_WITH_INSTALL_NAME) 40 set_target_properties (${libtarget} PROPERTIES 41 LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" 42 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" 43 BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} 44 ) 45 endif () 46 if (HDF5_BUILD_FRAMEWORKS) 47 if (${libtype} MATCHES "SHARED") 48 # adapt target to build frameworks instead of dylibs 49 set_target_properties(${libtarget} PROPERTIES 50 XCODE_ATTRIBUTE_INSTALL_PATH "@rpath" 51 FRAMEWORK TRUE 52 FRAMEWORK_VERSION ${HDF5_PACKAGE_VERSION_MAJOR} 53 MACOSX_FRAMEWORK_IDENTIFIER org.hdfgroup.${libtarget} 54 MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${HDF5_PACKAGE_VERSION_MAJOR} 55 MACOSX_FRAMEWORK_BUNDLE_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) 56 endif () 57 endif () 58 endif () 59 60endmacro () 61