From: maier Date: Sat, 26 Oct 2013 15:24:11 +0000 (+0000) Subject: Bugfix: Guard reading of H5Pubconf.h in FindHDF5.cmake, fix corrupted configure_hdf5... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df96f3a80069c8aa499cfe598551a0af2e69e3b4;p=dealii-svn.git Bugfix: Guard reading of H5Pubconf.h in FindHDF5.cmake, fix corrupted configure_hdf5.cmake git-svn-id: https://svn.dealii.org/trunk@31446 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/configure/configure_hdf5.cmake b/deal.II/cmake/configure/configure_hdf5.cmake index 9816054301..a5a40a255a 100644 --- a/deal.II/cmake/configure/configure_hdf5.cmake +++ b/deal.II/cmake/configure/configure_hdf5.cmake @@ -22,11 +22,13 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var) FIND_PACKAGE(HDF5) IF(HDF5_FOUND) - IF( (HDF5_WITH_MPI AND DEAL_II_WITH_MPI) - OR - (NOT HDF5_WITH_MPI AND NOT DEAL_II_WITH_MPI)) + + IF( (HDF5_WITH_MPI AND DEAL_II_WITH_MPI) OR + (NOT HDF5_WITH_MPI AND NOT DEAL_II_WITH_MPI) ) SET(${var} TRUE) + ELSE() + MESSAGE(STATUS "Insufficient hdf5 installation found: " "hdf5 has to be configured with the same MPI configuration as deal.II." ) @@ -36,14 +38,23 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var) " DEAL_II_WITH_MPI = ${DEAL_II_WITH_MPI}\n" " HDF5_WITH_MPI = ${HDF5_WITH_MPI}\n" ) + UNSET(HDF5_HL_LIBRARY CACHE) + UNSET(HDF5_INCLUDE_DIR CACHE) + UNSET(HDF5_LIBRARY CACHE) + UNSET(HDF5_PUBCONF CACHE) ENDIF() + ENDIF() +ENDMACRO() + +MACRO(FEATURE_HDF5_CONFIGURE_EXTERNAL) INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS}) + + # The user has to know the location of the HDF5 headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS}) - DEAL_II_APPEND_LIBRARIES(${HDF5_LIBRARIES}) - - ENDIF() + DEAL_II_APPEND_LIBRARIES(${HDF5_LIBRARIES}) ENDMACRO() + CONFIGURE_FEATURE(HDF5) diff --git a/deal.II/cmake/modules/FindHDF5.cmake b/deal.II/cmake/modules/FindHDF5.cmake index bac83af2d6..fec6194dbe 100644 --- a/deal.II/cmake/modules/FindHDF5.cmake +++ b/deal.II/cmake/modules/FindHDF5.cmake @@ -49,18 +49,28 @@ FIND_LIBRARY(HDF5_HL_LIBRARY NAMES hdf5_hl lib${LIB_SUFFIX} lib64 lib ) +FIND_FILE(HDF5_PUBCONF H5pubconf.h + HINTS + ${HDF5_INCLUDE_DIR} + ${HDF5_DIR} + PATH_SUFFIXES + hdf5 hdf5/include include/hdf5 include + ) + SET(_output ${HDF5_HL_LIBRARY} ${HDF5_LIBRARY}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG _output # Cosmetic: Gives nice output HDF5_HL_LIBRARY HDF5_LIBRARY HDF5_INCLUDE_DIR + HDF5_PUBCONF ) MARK_AS_ADVANCED( HDF5_LIBRARY HDF5_HL_LIBRARY HDF5_INCLUDE_DIR + HDF5_PUBCONF ) IF(HDF5_FOUND) @@ -76,7 +86,7 @@ IF(HDF5_FOUND) # # Is hdf5 compiled with support for mpi? # - FILE(STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" HDF5_MPI_STRING + FILE(STRINGS ${HDF5_PUBCONF} HDF5_MPI_STRING REGEX "#define.*H5_HAVE_PARALLEL 1") IF("${HDF5_MPI_STRING}" STREQUAL "") SET(HDF5_WITH_MPI FALSE)