-# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2021 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
IF(HDF5_ROOT_DIR)
SET (HDF5_ROOT ${HDF5_ROOT_DIR})
+ IF(WIN32)
+ SET(HDF5_DIR ${HDF5_ROOT_DIR}/cmake/hdf5)
+ ENDIF()
ENDIF()
SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(HDF5 HDF5_INCLUDE_DIR 1)
SET(HDF5_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS};${HDF5_INCLUDE_DIR}")
# Same story with libraries - if in CONFIG mode, HDF5_LIBRARIES is not defined:
IF(NOT DEFINED HDF5_LIBRARIES)
- IF(TARGET hdf5)
- SET(HDF5_LIBRARIES hdf5)
- ENDIF()
+ IF(TARGET hdf5)
+ SET(HDF5_LIBRARIES hdf5)
+ ELSEIF(TARGET hdf5::hdf5-shared)
+ SET(HDF5_LIBRARIES hdf5::hdf5-shared)
+ ENDIF()
ENDIF()
##
# HDF5 was compiled with MPI support
# Unfortunately HDF5 doesn't expose its MPI configuration easily ...
# We sniff the properties of the HDF5 target which should also be there:
- GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)
+ IF(NOT DEFINED HDF5_LIBRARIES)
+ SET(HDF5_LIBRARIES "hdf5")
+ IF(NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared)
+ # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc
+ SET(_target_prefix "hdf5::")
+ ENDIF()
+ SET(_suffix "-shared")
+ SET(HDF5_LIBRARIES "${_target_prefix}hdf5${_suffix}")
+ ENDIF()
+ GET_PROPERTY(_lib_lst TARGET ${HDF5_LIBRARIES} PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)
FOREACH(s ${_lib_lst})
STRING(FIND "${s}" "mpi." _res) # should cover WIN(?) and LINUX
IF(_res GREATER -1)