Problem 2484 - fix G4hdf5 not respecting HDF5_INCLUDE_DIRS
Summary: fix G4hdf5 not respecting HDF5_INCLUDE_DIRS
Status: ASSIGNED
Alias: None
Product: Geant4
Classification: Unclassified
Component: cmake (show other problems)
Version: 11.0
Hardware: All All
: P4 trivial
Assignee: Ben Morgan
URL:
Depends on:
Blocks:
 
Reported: 2022-04-10 12:36 CEST by Stephan Lachnit
Modified: 2022-07-13 15:38 CEST (History)
0 users

See Also:


Attachments
Patch to fix the issue (418 bytes, patch)
2022-04-10 12:36 CEST, Stephan Lachnit
Details | Diff

Note You need to log in before you can comment on or make changes to this problem.
Description Stephan Lachnit 2022-04-10 12:36:04 CEST
Created attachment 766 [details]
Patch to fix the issue

Currently, HDF5_INCLUDE_DIRS is not respected by Geant4, which causes a build failure on Debian.
This might not have noticed since the headers might live in /usr/include on some distros. However in Debian, HDF5 headers are located in an other directory that depends on if HDF5 is used with MPI support or not (i.e. /usr/include/hdf5/serial/hdf5.h and /usr/include/hdf5/openmpi/hdf5.h).

The underlying problem here is that G4tools does not respect properties of its dependencies at all. This can be fixed in two ways: either properly link HDF5 in G4tools, or do it where G4tools is used. Since it seems that is not wanted to make G4tools a proper module (it e.g. also misses linking for FreeType), I attached a patch to fix this in G4analysis/G4hdf5.
Comment 1 Ben Morgan 2022-07-13 15:38:34 CEST
HDF5_LIBRARIES is now just the `hdf5::hdf5` imported target, which is created, if CMake's `FindHDF` module does not, in `G4HDF5Shim.cmake`.

That should only require the `HDF5_C_INCLUDE_DIRS` variable, so could you check on the Debian build if:

- The CMake version creates the `hdf5::hdf5` imported target
- What the `INTERFACE_INCLUDE_DIRECTORIES` property of the `hdf5::hdf5` target are (whether or not CMake or Geant4 create it

In any case, if a patch is needed, it should go in `G4HDF5Shim.cmake` to make the imported target work correctly.