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 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. 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}