diff --git a/meson.build b/meson.build
index 2504c1dd52f1623e04143398099f9111cb85b0fb..b36f2740fd008e9972f4a54549dc10df1495c2a4 100644
--- a/meson.build
+++ b/meson.build
@@ -145,6 +145,21 @@ opt_orctest = get_option('orc-test')
 opt_tests = get_option('tests')
 opt_tools = get_option('tools')
 
+if cc.compiles ('''#include <Availability.h>
+#include <TargetConditionals.h>
+#if defined(APPLE)
+# if TARGET_OS_OSX
+# error "Targeting macOS device"
+# endif
+#else
+#error "Not building for Apple devices"
+#endif''', name : 'building for non-macOS Darwin platform')
+  if not opt_orctest.disabled()
+    warning('Tests are only supported in macOS.')
+    opt_tests = disabler()
+  endif
+endif
+
 if not opt_orctest.disabled()
   subdir('orc-test')
 else