From 098afc41e8fca5de1f3484a003458b1cb6a3ee8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= <nico.schloemer@gmail.com>
Date: Fri, 22 Sep 2017 14:15:19 +0200
Subject: [PATCH] cmake: use the native HDF5 finder

---
 CMakeLists.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ebd0c6bce..e73e7582b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -841,8 +841,10 @@ if(ENABLE_FOURIER_MODEL)
 endif(ENABLE_FOURIER_MODEL)
 
 if(ENABLE_MED OR ENABLE_CGNS)
-  find_library(HDF5_LIB hdf5)
-  if(HDF5_LIB)
+  find_package(HDF5)
+  if(HDF5_FOUND)
+    set(HDF5_LIB "${HDF5_C_LIBRARIES}")
+    list(APPEND EXTERNAL_INCLUDES ${HDF5_INCLUDE_DIRS})
     if(ENABLE_MED)
       find_library(MED_LIB med)
       if(MED_LIB)
@@ -873,9 +875,9 @@ if(ENABLE_MED OR ENABLE_CGNS)
         endif(ZLIB_FOUND)
       endif(NOT HAVE_LIBZ)
     endif(MED_LIB OR CGNS_LIB)
-  else(HDF5_LIB)
+  else(HDF5_FOUND)
     message(STATUS "HDF5 not found")
-  endif(HDF5_LIB)
+  endif(HDF5_FOUND)
 endif(ENABLE_MED OR ENABLE_CGNS)
 
 if(HAVE_SOLVER)
-- 
GitLab