diff --git a/ext/qt/meson.build b/ext/qt/meson.build
index c86e86a55b1a1f0b1d0b640242264289d10d4db0..cb4e13c8b398b862da2b4fbf6737076e25ab6a9a 100644
--- a/ext/qt/meson.build
+++ b/ext/qt/meson.build
@@ -84,7 +84,7 @@ if not have_qpa_include
   endif
 endif
 if not have_qpa_include
-  qmake = find_program('qmake-qt5', 'qmake')
+  qmake = find_program('qmake-qt5', 'qmake', required: false)
   if qmake.found()
     qt_version = run_command(qmake, '-query', 'QT_VERSION').stdout().strip()
     qt_include_dir = run_command(qmake, '-query', 'QT_INSTALL_HEADERS').stdout().strip()
@@ -98,6 +98,9 @@ if not have_qpa_include
     endif
   endif
 endif
+:q
+
+:q
 
 # Try to come up with all the platform/winsys combinations that will work