aboutsummaryrefslogtreecommitdiff
path: root/ports/vtk/FindHDF5.cmake
blob: 4a8c4a16656b41e73c8eb7d0bafdb1a6a45386a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
find_package(HDF5 NO_MODULE REQUIRED)

set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})

add_library(vtk::hdf5::hdf5 INTERFACE IMPORTED GLOBAL)
if(TARGET hdf5-static)
    set_target_properties(vtk::hdf5::hdf5 PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5-static")
elseif(TARGET hdf5-shared)
    set_target_properties(vtk::hdf5::hdf5 PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5-shared")
else()
    message(FATAL_ERROR "could not find target hdf5-*")
endif()

add_library(vtk::hdf5::hdf5_hl INTERFACE IMPORTED GLOBAL)
if(TARGET hdf5_hl-static)
    set_target_properties(vtk::hdf5::hdf5_hl PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5_hl-static")
elseif(TARGET hdf5_hl-shared)
    set_target_properties(vtk::hdf5::hdf5_hl PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5_hl-shared")
else()
    message(FATAL_ERROR "could not find target hdf5_hl-*")
endif()

set(HDF5_LIBRARIES "$<BUILD_INTERFACE:vtk::hdf5::hdf5>" "$<BUILD_INTERFACE:vtk::hdf5::hdf5_hl>")

find_package_handle_standard_args(HDF5
    REQUIRED_VARS HDF5_INCLUDE_DIRS HDF5_LIBRARIES
)