]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Bugfix: Guard reading of H5Pubconf.h in FindHDF5.cmake, fix corrupted configure_hdf5...
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 26 Oct 2013 15:24:11 +0000 (15:24 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 26 Oct 2013 15:24:11 +0000 (15:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@31446 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/configure/configure_hdf5.cmake
deal.II/cmake/modules/FindHDF5.cmake

index 98160543019f0920f6eda9cd3b6b2be63350cd14..a5a40a255ae712df9fb9b7fadb50546c11be589b 100644 (file)
@@ -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)
index bac83af2d6fa94ab469d53f36bb7a75db154e888..fec6194dbe20d0eeb4ad90ffc42df65981259e5a 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.