diff --git a/meson.build b/meson.build
index 9a98f0c86a0..b9f907e808b 100644
--- a/meson.build
+++ b/meson.build
@@ -1470,7 +1470,14 @@ endif
 zlibopt = get_option('zlib')
 zlib = not_found_dep
 if not zlibopt.disabled()
-  zlib_t = dependency('zlib', required: zlibopt)
+  if host_system != 'windows'
+    zlib_t = dependency('zlib', required: zlibopt)
+  else
+    zlib_t = dependency('zlib', required: false)
+    if not zlib_t.found()
+      zlib_t = cc.find_library('zlib', required: zlibopt, dirs: postgres_lib_d)
+    endif
+  endif
 
   if zlib_t.type_name() == 'internal'
     # if fallback was used, we don't need to test if headers are present (they
