aboutsummaryrefslogtreecommitdiff
path: root/ports/vtk/FindHDF5.cmake
blob: f3c6bd30fc70b102049f08e9cd4c4dcac2526ae0 (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
28
29
30
31
find_package(HDF5 NO_MODULE REQUIRED)

set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})

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

if(NOT TARGET vtk::hdf5::hdf5_hl)
    add_library(vtk::hdf5::hdf5_hl INTERFACE IMPORTED GLOBAL)
    if(TARGET hdf5::hdf5_hl-static)
        set_target_properties(vtk::hdf5::hdf5_hl PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::hdf5_hl-static")
    elseif(TARGET hdf5::hdf5_hl-shared)
        set_target_properties(vtk::hdf5::hdf5_hl PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::hdf5_hl-shared")
    else()
        message(FATAL_ERROR "could not find target hdf5_hl-*")
    endif()
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
)