From 1fafdc9da3b3ca17a019cdf237958da29788160a Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:07:39 -0500 Subject: [PATCH] Fix the examples for testing java with binaries (#4660) --- HDF5Examples/config/cmake/HDFExampleMacros.cmake | 15 ++++++++++++++- config/cmake/hdf5-config.cmake.in | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/HDF5Examples/config/cmake/HDFExampleMacros.cmake b/HDF5Examples/config/cmake/HDFExampleMacros.cmake index c540918b9f1..c5e7b70c6bb 100644 --- a/HDF5Examples/config/cmake/HDFExampleMacros.cmake +++ b/HDF5Examples/config/cmake/HDFExampleMacros.cmake @@ -227,7 +227,20 @@ macro (HDF5_SUPPORT) if (HDF_BUILD_JAVA AND HDF5_Java_FOUND) if (${HDF5_BUILD_JAVA}) set (CMAKE_JAVA_INCLUDE_PATH "${CMAKE_JAVA_INCLUDE_PATH};${HDF5_JAVA_INCLUDE_DIRS}") - set (H5EX_JAVA_LIBRARY ${HDF5_JAVA_LIBRARY}) + if (HDF5_BUILD_MODE) + string(TOUPPER "${HDF5_BUILD_MODE}" UPPER_BUILD_TYPE) + get_target_property(libsoname ${HDF5_JAVA_LIBRARY} IMPORTED_SONAME_${UPPER_BUILD_TYPE}) + elseif (HDF_CFG_NAME) + string(TOUPPER "${HDF_CFG_NAME}" UPPER_BUILD_TYPE) + get_target_property(libsoname ${HDF5_JAVA_LIBRARY} IMPORTED_SONAME_${UPPER_BUILD_TYPE}) + else() + get_target_property(libsoname ${HDF5_JAVA_LIBRARY} IMPORTED_SONAME) + endif() + get_filename_component (libname ${libsoname} NAME_WE) + string (REGEX REPLACE "^lib" "" libname ${libname}) + message (STATUS "HDF5 lib:${HDF5_JAVA_LIBRARY} OR ${libsoname} OR ${libname}") + set (H5EX_JAVA_LIBRARY ${libname}) +# set (H5EX_JAVA_LIBRARY $) set (H5EX_JAVA_LIBRARIES ${HDF5_JAVA_LIBRARY}) message (STATUS "HDF5 lib:${H5EX_JAVA_LIBRARY} jars:${HDF5_JAVA_INCLUDE_DIRS}}") else () diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index ad1c30bcd80..c052762a195 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -29,6 +29,8 @@ set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS Tools ) +set (${HDF5_PACKAGE_NAME}_BUILD_MODE @HDF_CFG_NAME@) + #----------------------------------------------------------------------------- # User Options #-----------------------------------------------------------------------------