package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

79 lines
2.6 KiB

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c50784b3..dd97d117 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -171,11 +171,6 @@ install(FILES
DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}
COMPONENT development)
-install(FILES
- cmake/FindHDF5.cmake
- DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}/hdf5
- COMPONENT development)
-
#
# uninstall target
#
diff --git a/cmake/HDF5LibraryConfig.cmake b/cmake/HDF5LibraryConfig.cmake
index c05fe75f..7461f5ea 100644
--- a/cmake/HDF5LibraryConfig.cmake
+++ b/cmake/HDF5LibraryConfig.cmake
@@ -2,22 +2,24 @@ if(H5CPP_WITH_MPI)
set(HDF5_PREFER_PARALLEL TRUE)
endif()
-find_package(HDF5 REQUIRED COMPONENTS C HL)
+find_package(HDF5 CONFIG REQUIRED COMPONENTS C HL)
+if(H5CPP_BUILD_SHARED)
+ set(libtype SHARED)
+else()
+ set(libtype STATIC)
+endif()
message(STATUS "==============================================================")
message(STATUS "========================Found HDF5============================")
message(STATUS "==============================================================")
-message(STATUS "Found HDF5 libraries in: ${HDF5_LIBRARY_DIRS}")
-message(STATUS "Found HDF5 libraries: ${HDF5_LIBRARIES}")
-message(STATUS "Found HDF5 HL libraries: ${HDF5_HL_LIBRARIES}")
-message(STATUS "Found HDF5 headers: ${HDF5_INCLUDE_DIRS}")
-message(STATUS "Found HDF5 definitions: ${HDF5_DEFINITIONS}")
+message(STATUS "Found HDF5 libraries: ${HDF5_EXPORT_LIBRARIES}")
+message(STATUS "Found HDF5 headers: ${HDF5_INCLUDE_DIR}")
message(STATUS "Found HDF5 HDF5_VERSION = ${HDF5_VERSION}")
-message(STATUS "Found HDF5 HDF5_IS_PARALLEL = ${HDF5_IS_PARALLEL}")
+message(STATUS "Found HDF5 HDF5_ENABLE_PARALLEL = ${HDF5_ENABLE_PARALLEL}")
message(STATUS "==============================================================")
if(H5CPP_WITH_MPI)
- if(NOT HDF5_IS_PARALLEL)
+ if(NOT HDF5_ENABLE_PARALLEL)
message(FATAL_ERROR "The HDF5 version found does not support MPI")
endif()
endif()
diff --git a/src/h5cpp/CMakeLists.txt b/src/h5cpp/CMakeLists.txt
index 03a98885..0c8cd9de 100644
--- a/src/h5cpp/CMakeLists.txt
+++ b/src/h5cpp/CMakeLists.txt
@@ -39,6 +39,9 @@ add_doxygen_source_deps(${h5cpp_headers})
if (H5CPP_BUILD_SHARED)
target_compile_definitions(h5cpp PRIVATE H5CPP_EXPORTS PUBLIC H5CPP_BUILD_SHARED)
+ set(_suffix "shared")
+else()
+ set(_suffix "static")
endif()
set(H5CPP_LINKS ${MPI_CXX_LIBRARIES})
@@ -86,9 +89,9 @@ endif()
target_link_libraries(h5cpp
PUBLIC
${H5CPP_LINKS}
- hdf5::hdf5
+ "hdf5::hdf5-${_suffix}"
PRIVATE ${COVERAGE_LIBRARIES}
- hdf5::hdf5_hl
+ "hdf5::hdf5_hl-${_suffix}"
Threads::Threads
${H5CPP_FILTER_TARGETS}
${CMAKE_DL_LIBS}