From 4c0140b485f3fc90e58a7977f7b2182a454a2944 Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Thu, 11 May 2023 09:08:08 +0200 Subject: [PATCH 1/4] add HDF5_INCLUDE_DIRS and MPI_CXX_INCLUDE_PATH back --- h5cpp-config.cmake.in | 1 + src/h5cpp/CMakeLists.txt | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/h5cpp-config.cmake.in b/h5cpp-config.cmake.in index 637af850a8..aa17c958e8 100644 --- a/h5cpp-config.cmake.in +++ b/h5cpp-config.cmake.in @@ -42,6 +42,7 @@ find_dependency(ZLIB) # checking for hdf5 # set(HDF5_PREFER_PARALLEL @H5CPP_WITH_MPI@) +# find_package(HDF5 @HDF5_VERSION@ EXACT REQUIRED COMPONENTS C) find_dependency(HDF5 @HDF5_VERSION@ EXACT COMPONENTS C HL) if(H5CPP_MPI_ENABLED AND (NOT HDF5_IS_PARALLEL)) diff --git a/src/h5cpp/CMakeLists.txt b/src/h5cpp/CMakeLists.txt index 509a56c68f..510fcd61e9 100644 --- a/src/h5cpp/CMakeLists.txt +++ b/src/h5cpp/CMakeLists.txt @@ -55,8 +55,26 @@ else() endif() endif() +# +# remove the absolute path from the library name +# +set(H5CPP_INTERFACE_LIBS) +set(H5CPP_PRIVATE_LIBS ${HDF5_LIBRARIES}) +foreach(HDF5_LIBRARY ${HDF5_LIBRARIES}) + get_filename_component(LIB_NAME ${HDF5_LIBRARY} NAME) + list(APPEND H5CPP_INTERFACE_LIBS ${LIB_NAME}) +endforeach() + +set(H5CPP_HL_PRIVATE_LIBS ${HDF5_HL_LIBRARIES}) +foreach(HDF5_LIBRARY ${HDF5_HL_LIBRARIES}) + get_filename_component(LIB_NAME ${HDF5_LIBRARY} NAME) + list(APPEND H5CPP_INTERFACE_LIBS ${LIB_NAME}) +endforeach() + target_include_directories(h5cpp PRIVATE ${PROJECT_SOURCE_DIR}/src + PUBLIC ${HDF5_INCLUDE_DIRS} + PUBLIC ${MPI_CXX_INCLUDE_PATH} INTERFACE $ INTERFACE $ ) @@ -97,7 +115,7 @@ if (TARGET SZIP::SZIP) endif() target_link_libraries(h5cpp - PUBLIC + PUBLIC ${H5CPP_LINKS} hdf5::hdf5 PRIVATE ${COVERAGE_LIBRARIES} From cf604055c36e37e132c199ced40b4d752274c94f Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Thu, 11 May 2023 09:34:58 +0200 Subject: [PATCH 2/4] update tests to macos 11 --- .github/workflows/cmake-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-build.yml b/.github/workflows/cmake-build.yml index ee30cfa053..2be22d168c 100644 --- a/.github/workflows/cmake-build.yml +++ b/.github/workflows/cmake-build.yml @@ -172,7 +172,7 @@ jobs: .\conanrunenv-release-x86_64.ps1 ctest --extra-verbose --no-tests=error --output-on-failure shell: pwsh - macos-10: + macos-11: strategy: matrix: shared: ["shared", "static"] @@ -181,7 +181,7 @@ jobs: # "mpi", "serial" ] - runs-on: macos-10.15 + runs-on: macos-11 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 From 3830f117246c7f564444f63ef31846f84f36ca9d Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Thu, 11 May 2023 10:26:55 +0200 Subject: [PATCH 3/4] fix target_link_libraries h5cpp::h5cpp in documentation --- README.md | 2 +- doc/source/users_guide/using.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6887fdcddf..5dee2cd1fd 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ find_package(h5cpp REQUIRED) . . add_executable(some_target some_code.cpp) -target_link_libraries(some_target h5cpp) +target_link_libraries(some_target h5cpp::h5cpp) ``` and adding the following: ```cpp diff --git a/doc/source/users_guide/using.rst b/doc/source/users_guide/using.rst index 469e79ef3f..0fd72b0590 100644 --- a/doc/source/users_guide/using.rst +++ b/doc/source/users_guide/using.rst @@ -46,7 +46,7 @@ the following :file:`CMakeLists.txt` fiel is sufficient find_package(h5cpp REQUIRED) add_executable(h5cpp_test main.cpp) - target_link_libraries(h5cpp_test h5cpp) + target_link_libraries(h5cpp_test h5cpp::h5cpp) Despite the C++ language standard all dependencies are provided by the package file via the imported target. From 16c000bc19a5106e054f6f8aedec8ba91ac5bbef Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Thu, 11 May 2023 10:42:30 +0200 Subject: [PATCH 4/4] clean the PR --- h5cpp-config.cmake.in | 1 - 1 file changed, 1 deletion(-) diff --git a/h5cpp-config.cmake.in b/h5cpp-config.cmake.in index aa17c958e8..637af850a8 100644 --- a/h5cpp-config.cmake.in +++ b/h5cpp-config.cmake.in @@ -42,7 +42,6 @@ find_dependency(ZLIB) # checking for hdf5 # set(HDF5_PREFER_PARALLEL @H5CPP_WITH_MPI@) -# find_package(HDF5 @HDF5_VERSION@ EXACT REQUIRED COMPONENTS C) find_dependency(HDF5 @HDF5_VERSION@ EXACT COMPONENTS C HL) if(H5CPP_MPI_ENABLED AND (NOT HDF5_IS_PARALLEL))