Skip to content

Commit

Permalink
[cmake] Work around issue of detecting hdf5 version for releases with…
Browse files Browse the repository at this point in the history
… subversion
  • Loading branch information
Wentzell committed Jul 22, 2024
1 parent 64c0632 commit 0be0e93
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions c++/h5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING
message(STATUS "-------- HDF5 detection -------------")

find_package(HDF5 REQUIRED C HL)
if(NOT HDF5_VERSION)
set(HDF5_SUBVERSION_ISSUE TRUE)
endif()

# Link against interface target and export
target_link_libraries(h5_c PRIVATE hdf5::hdf5 hdf5::hdf5_hl)
if(HDF5_VERSION VERSION_GREATER 1.10)
if(HDF5_VERSION VERSION_GREATER 1.10 OR HDF5_SUBVERSION_ISSUE)
target_compile_definitions(h5_c PRIVATE H5_USE_110_API)
endif()
if(HDF5_VERSION VERSION_GREATER_EQUAL 1.13)
if(HDF5_VERSION VERSION_GREATER_EQUAL 1.13 OR HDF5_SUBVERSION_ISSUE)
target_compile_definitions(h5_c PRIVATE H5_VER_GE_113)
endif()

Expand Down

0 comments on commit 0be0e93

Please sign in to comment.