meson: Use subproject zlib if "wrap_mode=forcefallback" was specified

"wrap_mode=forcefallback" would mean that user wants to use dependency
which was built from our source, instead of system installed one.
This commit is contained in:
Seungha Yang 2021-02-22 19:14:43 +09:00
parent 0da87b090e
commit 97c7cb0e71

View File

@ -2004,9 +2004,15 @@ endif
libm = cc.find_library('m', required : false)
libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep'])
# Don't use the bundled ZLib sources until we are sure that we can't find it on
# the system
libz_dep = dependency('zlib', required : false)
if get_option('wrap_mode') == 'forcefallback'
# Respects "wrap_mode=forcefallback" option
libz_dep = subproject('zlib').get_variable('zlib_dep')
else
# Don't use the bundled ZLib sources until we are sure that we can't find it on
# the system
libz_dep = dependency('zlib', required : false)
endif
if not libz_dep.found()
if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
libz_dep = cc.find_library('z', required : false)