From 81329cdd40694d5df5ad294de012722a664c4716 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Fri, 23 Jul 2021 11:48:07 +0200
Subject: [PATCH] [cmake] Fix build with system zlib.

---
 scripts/cmake/Dependencies.cmake | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake
index d40025ab2c6..63d40dbb523 100644
--- a/scripts/cmake/Dependencies.cmake
+++ b/scripts/cmake/Dependencies.cmake
@@ -205,7 +205,10 @@ else()
     if(HDF5_ADDED)
         target_include_directories(hdf5-static INTERFACE ${HDF5_BINARY_DIR})
         list(APPEND DISABLE_WARNINGS_TARGETS hdf5-static)
-        set(HDF5_LIBRARIES hdf5-static zlibstatic)
+        set(HDF5_LIBRARIES hdf5-static)
+        if(ZLIB_ADDED)
+            list(APPEND HDF5_LIBRARIES zlibstatic)
+        endif()
         set(HDF5_C_INCLUDE_DIR ${HDF5_SOURCE_DIR})
         set(HDF5_INCLUDE_DIR ${HDF5_SOURCE_DIR})
     endif()
-- 
GitLab