diff --git a/meson.build b/meson.build
index 9a98f0c86a0..9f4ab748023 100644
--- a/meson.build
+++ b/meson.build
@@ -854,13 +854,20 @@ endif
 
 libxmlopt = get_option('libxml')
 if not libxmlopt.disabled()
-  libxml = dependency('libxml-2.0', required: false, version: '>= 2.6.23')
-  # Unfortunately the dependency is named differently with cmake
-  if not libxml.found() # combine with above once meson 0.60.0 is required
-    libxml = dependency('LibXml2', required: libxmlopt, version: '>= 2.6.23',
-      method: 'cmake')
+  if host_system != 'windows'
+    libxml = dependency('libxml-2.0', required: false, version: '>= 2.6.23')
+    # Unfortunately the dependency is named differently with cmake
+    if not libxml.found() # combine with above once meson 0.60.0 is required
+      libxml = dependency('LibXml2', required: libxmlopt, version: '>= 2.6.23',
+        method: 'cmake')
+    endif
+  else
+    libxml = dependency('libxml2', required: false, version: '>= 2.6.23')
+    if not libxml.found()
+       libxml = cc.find_library('libxml2', required: libxmlopt, dirs: postgres_lib_d)
+    endif
   endif
-
+  
   if libxml.found()
     cdata.set('USE_LIBXML', 1)
   endif
