|
Lines 1-10
Link Here
|
| 1 |
# - G4HDF5Shim |
1 |
# - G4HDF5Shim |
| 2 |
# |
2 |
# |
| 3 |
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer |
3 |
# Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer |
| 4 |
# The HDF5 dependency is located through CMake's builtin FindHDF5 |
4 |
# The HDF5 dependency is located through CMake's builtin FindHDF5 |
| 5 |
# module, but this does not supply imported targets as of CMake 3.16. |
5 |
# module, but this does not supply imported targets until CMake 3.20. |
| 6 |
# It may use HDF5's hdf5-config.cmake file if available, so create |
6 |
# It may use HDF5's hdf5-config.cmake file if available, so create |
| 7 |
# custom imported target Geant4::HDF5 to allow both cases to be handled |
7 |
# custom imported target hdf5::hdf5 to allow both cases to be handled |
| 8 |
# without interference with either. |
8 |
# without interference with either. |
| 9 |
|
9 |
|
| 10 |
if(HDF5_FOUND) |
10 |
if(HDF5_FOUND) |
|
Lines 24-41
if(HDF5_FOUND)
Link Here
|
| 24 |
endif() |
24 |
endif() |
| 25 |
endif() |
25 |
endif() |
| 26 |
|
26 |
|
| 27 |
# As FindHDF5 does not yet supply imported targets, we |
27 |
# If FindHDF5 does not yet supply imported targets, we |
| 28 |
# create an internal INTERFACE target to wrap these. |
28 |
# create an internal INTERFACE target to wrap these. |
| 29 |
# This still hard-codes include/library paths, but limits it |
29 |
# This still hard-codes include/library paths, but limits it |
| 30 |
# to one place. Later, we'll create proper imported targets |
30 |
# to one place. Later, we'll create proper imported targets |
| 31 |
# with re-finds but for now this is the best minimally invasive proceedure |
31 |
# with re-finds but for now this is the best minimally invasive proceedure |
| 32 |
if(NOT TARGET Geant4::HDF5) |
32 |
if(NOT TARGET hdf5::hdf5) |
| 33 |
add_library(Geant4::HDF5 IMPORTED UNKNOWN) |
33 |
add_library(hdf5::hdf5 IMPORTED UNKNOWN) |
| 34 |
set_target_properties(Geant4::HDF5 PROPERTIES |
34 |
set_target_properties(hdf5::hdf5 PROPERTIES |
| 35 |
IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
35 |
IMPORTED_LINK_INTERFACE_LANGUAGES "C" |
| 36 |
IMPORTED_LOCATION "${HDF5_C_LIBRARY_hdf5}" |
36 |
IMPORTED_LOCATION "${HDF5_C_LIBRARY_hdf5}" |
| 37 |
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_C_INCLUDE_DIRS}" |
37 |
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_C_INCLUDE_DIRS}" |
| 38 |
INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}" |
38 |
INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}" |
| 39 |
) |
39 |
) |
| 40 |
endif() |
40 |
endif() |
| 41 |
endif() |
41 |
endif() |