SET(HDF5_DIR "" CACHE PATH "An optional hint to an hdf5 directory")
SET_IF_EMPTY(HDF5_DIR "$ENV{HDF5_DIR}")
-DEAL_II_FIND_PATH(HDF5_INCLUDE_DIR hdf5.h
- HINTS ${HDF5_DIR}
- PATH_SUFFIXES hdf5 hdf5/include include/hdf5 include
- )
-
-DEAL_II_FIND_LIBRARY(HDF5_LIBRARY NAMES hdf5
- HINTS ${HDF5_DIR}
- PATH_SUFFIXES hdf5/lib lib${LIB_SUFFIX} lib64 lib
- )
-
-DEAL_II_FIND_LIBRARY(HDF5_HL_LIBRARY NAMES hdf5_hl
- HINTS ${HDF5_DIR}
- PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
- )
+# temporarily disable ${CMAKE_SOURCE_DIR}/cmake/modules for module lookup
+LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+FIND_PACKAGE(HDF5)
+LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
-DEAL_II_FIND_FILE(HDF5_PUBCONF NAMES H5pubconf.h H5pubconf-64.h
- HINTS ${HDF5_INCLUDE_DIR} ${HDF5_DIR}
- PATH_SUFFIXES hdf5 hdf5/include include/hdf5 include
- )
-
-IF(EXISTS ${HDF5_PUBCONF})
+IF(HDF5_FOUND)
#
# Is hdf5 compiled with support for mpi?
#
+ DEAL_II_FIND_FILE(HDF5_PUBCONF NAMES H5pubconf.h H5pubconf-64.h
+ HINTS ${HDF5_INCLUDE_DIRS}
+ PATH_SUFFIXES
+ )
FILE(STRINGS ${HDF5_PUBCONF} HDF5_MPI_STRING
REGEX "#define.*H5_HAVE_PARALLEL 1"
)
ENDIF()
ENDIF()
+
+SET(_include_dirs "${HDF5_INCLUDE_DIRS}")
+SET(_libraries "${HDF5_LIBRARIES};${HDF5_HL_LIBRARIES}")
+
DEAL_II_PACKAGE_HANDLE(HDF5
LIBRARIES
- REQUIRED HDF5_HL_LIBRARY HDF5_LIBRARY
+ REQUIRED _libraries
OPTIONAL MPI_C_LIBRARIES
INCLUDE_DIRS
- REQUIRED HDF5_INCLUDE_DIR
+ REQUIRED _include_dirs
USER_INCLUDE_DIRS
- REQUIRED HDF5_INCLUDE_DIR
- CLEAR HDF5_HL_LIBRARY HDF5_LIBRARY HDF5_INCLUDE_DIR HDF5_PUBCONF
+ REQUIRED _include_dirs
+ CLEAR
+ HDF5_C_COMPILER_EXECUTABLE HDF5_C_LIBRARY_dl HDF5_C_LIBRARY_hdf5
+ HDF5_C_LIBRARY_m HDF5_C_LIBRARY_mpi HDF5_C_LIBRARY_sz HDF5_C_LIBRARY_z
+ HDF5_DIFF_EXECUTABLE HDF5_PUBCONF
)