diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46446da8a..cd05cf51a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,20 +221,10 @@ if (CGNS_ENABLE_HDF5)
   endif (HDF5_FOUND)
 
   set(HDF5_NEED_ZLIB "OFF" CACHE BOOL "Does the HDF5 library require linking to zlib?")
-  if(HDF5_NEED_ZLIB)
-    find_library(ZLIB_LIBRARY z)
-    mark_as_advanced(CLEAR ZLIB_LIBRARY)
-  else (HDF5_NEED_ZLIB)
-    mark_as_advanced(FORCE ZLIB_LIBRARY)
-  endif(HDF5_NEED_ZLIB)
+  set(HDF5_NEED_ZLIB ${HDF5_ENABLE_Z_LIB_SUPPORT} CACHE INTERNAL "" FORCE)
 
   set(HDF5_NEED_SZIP "OFF" CACHE BOOL "Does the HDF5 library require linking to zlib?")
-  if (HDF5_NEED_SZIP)
-    find_library(SZIP_LIBRARY szip)
-    mark_as_advanced(CLEAR SZIP_LIBRARY)
-  else (HDF5_NEED_SZIP)
-    mark_as_advanced(FORCE SZIP_LIBRARY)
-  endif (HDF5_NEED_SZIP)
+  set(HDF5_NEED_SZIP ${HDF5_ENABLE_SZIP_SUPPORT} CACHE INTERNAL "" FORCE)
 
   # Check if HDF5 version is 1.8 or greater
   if (HDF5_VERSION VERSION_LESS "1.8.0")
@@ -240,6 +231,7 @@ if (CGNS_ENABLE_HDF5)
   endif (HDF5_VERSION VERSION_LESS "1.8.0")
 
   set(HDF5_NEED_MPI "OFF" CACHE BOOL "Does the HDF5 library require linking to mpi? (Only true if using parallel HDF5)")
+  set(HDF5_NEED_MPI ${HDF5_ENABLE_PARALLEL} CACHE INTERNAL "" FORCE)
   set(MPI_INC)
   set(MPI_LIBS)
   if (HDF5_NEED_MPI)