Debian Codegraph @

test cases/common/221 zlib/meson.build

raw
1 project('zlib system dependency', 'c')
2
3 if not ['darwin', 'freebsd', 'dragonfly', 'windows', 'android'].contains(host_machine.system())
4 error('MESON_SKIP_TEST only applicable on macOS, FreeBSD, DragonFly BSD, Windows, and Android.')
5 endif
6
7 cc = meson.get_compiler('c')
8
9 if host_machine.system() == 'darwin' and cc.get_id() != 'clang'
10 # this will only work on mac if using Apple's clang compiler, but there is no
11 # way in the meson source level to differentiate apple clang and llvm clang
12 # In the meson CI only apple clang is tested
13 error('MESON_SKIP_TEST on macOS only clang is supported.')
14 endif
15
16 if not (cc.find_library('z', required: false).found() or
17 cc.find_library('zlib', required : false).found() or
18 cc.find_library('zlib1', required : false).found())
19 error('MESON_SKIP_TEST Cannot seem to find zlib via find_library, this test will probably fail.')
20 endif
21
22 z = dependency('zlib', method : 'system')
23 assert(z.version().version_compare('>= 1.2'), 'Version does not seem to have been detected correctly.')