meson: don't check disabled dependencies at all
Don't search for the dependency and set up fallback only to throw it away if the option is disabled. This is a waste, and this gives the user the illusion that the request to disable the feature was ignored.
This commit is contained in:
parent
e58e4a9149
commit
18503946d5
1 changed files with 20 additions and 18 deletions
38
meson.build
38
meson.build
|
@ -193,25 +193,27 @@ foreach dep: [
|
|||
['hunspell', '', 'Hunspell', ['hunspell', 'hunspell_dep']],
|
||||
['uchardet', '', 'uchardet', ['uchardet', 'uchardet_dep']],
|
||||
]
|
||||
dep_version = dep[1] != '' ? dep[1] : '>=0'
|
||||
# [provide] section is ignored if required is false;
|
||||
# must provided define fallback explicitly
|
||||
# (with meson 0.56 you can do allow_fallback: true):
|
||||
#d = dependency(dep[0], version: dep_version,
|
||||
# required: false, allow_fallback: true)
|
||||
if dep[3].length() > 0
|
||||
d = dependency(dep[0], version: dep_version, fallback: dep[3])
|
||||
else
|
||||
d = dependency(dep[0], version: dep_version, required: false)
|
||||
endif
|
||||
|
||||
optname = dep[0].split('-')[0]
|
||||
if d.found() and not get_option(optname).disabled()
|
||||
deps += d
|
||||
conf.set('WITH_@0@'.format(dep[0].split('-')[0].to_upper()), 1)
|
||||
dep_avail += dep[2]
|
||||
elif get_option(optname).enabled()
|
||||
error('@0@ enabled but not found'.format(dep[2]))
|
||||
if not get_option(optname).disabled()
|
||||
dep_version = dep[1] != '' ? dep[1] : '>=0'
|
||||
# [provide] section is ignored if required is false;
|
||||
# must provided define fallback explicitly
|
||||
# (with meson 0.56 you can do allow_fallback: true):
|
||||
#d = dependency(dep[0], version: dep_version,
|
||||
# required: false, allow_fallback: true)
|
||||
if dep[3].length() > 0
|
||||
d = dependency(dep[0], version: dep_version, fallback: dep[3])
|
||||
else
|
||||
d = dependency(dep[0], version: dep_version, required: false)
|
||||
endif
|
||||
|
||||
if d.found()
|
||||
deps += d
|
||||
conf.set('WITH_@0@'.format(dep[0].split('-')[0].to_upper()), 1)
|
||||
dep_avail += dep[2]
|
||||
elif get_option(optname).enabled()
|
||||
error('@0@ enabled but not found'.format(dep[2]))
|
||||
endif
|
||||
endif
|
||||
endforeach
|
||||
|
||||
|
|
Loading…
Reference in a new issue