Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/cmake/Modules/G4HDF5Shim.cmake is written in an unsupported language. File is not indexed.

0001 # - G4HDF5Shim
0002 #
0003 # Geant4's Geant4Config.cmake file aims to support CMake 3.8 and newer
0004 # The HDF5 dependency is located through CMake's builtin FindHDF5
0005 # module, but this does not supply imported targets until CMake 3.20.
0006 # It may use HDF5's hdf5-config.cmake file if available, so create
0007 # custom imported target hdf5::hdf5 to allow both cases to be handled
0008 # without interference with either.
0009  
0010 if(HDF5_FOUND)
0011  # If we're in MT mode, found HDF5 must also support MT
0012  if(GEANT4_BUILD_MULTITHREADED OR Geant4_multithreaded_FOUND)
0013    include(CheckCXXSymbolExists)
0014    set(CMAKE_REQUIRED_INCLUDES "${HDF5_INCLUDE_DIRS}")
0015    check_cxx_symbol_exists(H5_HAVE_THREADSAFE "H5pubconf.h" GEANT4_HAVE_H5_HAVE_THREADSAFE)
0016    unset(CMAKE_REQUIRED_INCLUDES)
0017 
0018    if(NOT GEANT4_HAVE_H5_HAVE_THREADSAFE)
0019      message(FATAL_ERROR
0020        "Found an install of HDF5, but it was not built with support for thread safety. "
0021        "Either build Geant4 in single threaded mode, or use/reinstall HDF5 with "
0022        "thread safety enabled. See HDF5's install guides, available from https://support.hdfgroup.org/HDF5/release/, for instructions on this.\n"
0023        )
0024    endif()
0025  endif()
0026 
0027  # If FindHDF5 does not yet supply imported targets, we
0028  # create an internal INTERFACE target to wrap these.
0029  # This still hard-codes include/library paths, but limits it
0030  # to one place. Later, we'll create proper imported targets
0031  # with re-finds but for now this is the best minimally invasive proceedure
0032  if(NOT TARGET hdf5::hdf5)
0033    add_library(hdf5::hdf5 IMPORTED UNKNOWN)
0034    set_target_properties(hdf5::hdf5 PROPERTIES
0035      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
0036      IMPORTED_LOCATION "${HDF5_C_LIBRARY_hdf5}"
0037      INTERFACE_INCLUDE_DIRECTORIES "${HDF5_C_INCLUDE_DIRS}"
0038      INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}"
0039      )
0040  endif()
0041 endif()