meson: use required : feature option correclty

The code here is a complicated way to write exactly the same thing. If
`get_option('x11')` returns `disabled`, ie `-Dx11=disabled` then
`dependency()` short circuits and returns a not found object (just like
`dependency('', required : false)`, but with the correct name for error
messages).
This commit is contained in:
Dylan Baker 2021-12-06 09:59:26 -08:00
parent 055a4bab62
commit 9d09a1a238
1 changed files with 1 additions and 5 deletions

View File

@ -87,11 +87,7 @@ endif
dep_dl = cc.find_library('dl', required : false)
dep_m = cc.find_library('m', required : false)
dep_threads = dependency('threads')
if get_option('x11').disabled()
dep_x11 = dependency('', required : false)
else
dep_x11 = dependency('x11', required : get_option('x11'))
endif
dep_x11 = dependency('x11', required : get_option('x11'))
dep_x11_headers = dep_x11.partial_dependency(compile_args : true, includes : true)
if dep_x11.found()