--- a/meson.build
+++ b/meson.build
@@ -460,7 +460,7 @@
   endif
 endif
 
-if qt6_dep.found()
+if qt6_dep.found() and x11_dep.found()
   shared_module(
     'suil_x11_in_qt6',
     files('src/x11_in_qt.cpp'),
