meson: work around meson issue #5115
authorDylan Baker <dylan@pnwbakers.com>
Mon, 25 Mar 2019 22:22:13 +0000 (15:22 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Wed, 27 Mar 2019 17:53:33 +0000 (10:53 -0700)
This issue causes openmp arguments to be injected into compilers that
can support openmp, even if they don't. This issue will be fixed in
0.51 (code already landed in mesonbuild#5116), for older versions lets
work around the issue.

meson.build

index fe77893b8cef60f60454ee7cdd28816328514bdb..2c6b57fd00dd2296bc29161e71dde43f4be05851 100644 (file)
@@ -376,13 +376,15 @@ if get_option('gnuplot')
   config.set('PIXMAN_GNUPLOT', 1)
 endif
 
-use_openmp = get_option('openmp')
-dep_openmp = null_dep
-if not use_openmp.disabled()
-  dep_openmp = dependency('openmp', required : get_option('openmp'))
-  if dep_openmp.found()
-    config.set10('USE_OPENMP', true)
-  endif
+dep_openmp = dependency('openmp', required : get_option('openmp'))
+if dep_openmp.found()
+  config.set10('USE_OPENMP', true)
+elif meson.version().version_compare('<0.51.0')
+# In versions of meson before 0.51 the openmp dependency can still
+# inject arguments in the the auto case when it is not found, the
+# detection does work correctly in that case however, so we just
+# replace dep_openmp with null_dep to work around this.
+  dep_openmp = null_dep
 endif
 
 dep_gtk = dependency('gtk+-2.0', version : '>= 2.16', required : get_option('gtk'))