# optional prerequisites
-if(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
+if(SALOME_USE_MPI OR HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)
find_package(SalomeMPI)
-endif(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
+endif(SALOME_USE_MPI OR HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)
if(SALOME_USE_CORBA)
find_package(OMNIORB)
# HDF5 detection for Salome
set(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} CACHE PATH "Path to Hdf5 directory")
+
+# If HDF5 is compiled with CMake, we use the config file
+if(EXISTS ${HDF5_ROOT_DIR}/share/cmake/hdf5)
+ INCLUDE(${HDF5_ROOT_DIR}/share/cmake/hdf5/hdf5-config.cmake)
+endif(EXISTS ${HDF5_ROOT_DIR}/share/cmake/hdf5)
+
if(EXISTS ${HDF5_ROOT_DIR})
set(CMAKE_INCLUDE_PATH ${HDF5_ROOT_DIR}/include)
set(CMAKE_LIBRARY_PATH ${HDF5_ROOT_DIR}/lib)
set(CMAKE_PROGRAM_PATH ${MPI_ROOT_DIR}/bin)
endif(EXISTS ${MPI_ROOT_DIR})
find_package(MPI REQUIRED)
-if(HDF5_IS_PARALLEL)
+if(HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH} )
set(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES})
-endif(HDF5_IS_PARALLEL)
+endif(HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL)