aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-01-17 12:15:16 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-01-31 09:28:56 -0800
commitb495d4ba22888c973163dc4688d5b51ee690a7c5 (patch)
tree517e15b070b75acc0990074c4b9fea12491ba494
parentc1a3b37ab7e4ccf3a946ee4ba6da81a4c230ecc4 (diff)
downloadmeson-b495d4ba22888c973163dc4688d5b51ee690a7c5.zip
meson-b495d4ba22888c973163dc4688d5b51ee690a7c5.tar.gz
meson-b495d4ba22888c973163dc4688d5b51ee690a7c5.tar.bz2
tests: Add a test case for the zlib system dependency
-rw-r--r--test cases/common/228 zlib/meson.build23
1 files changed, 23 insertions, 0 deletions
diff --git a/test cases/common/228 zlib/meson.build b/test cases/common/228 zlib/meson.build
new file mode 100644
index 0000000..c53f71e
--- /dev/null
+++ b/test cases/common/228 zlib/meson.build
@@ -0,0 +1,23 @@
+project('zlib system dependency', 'c')
+
+if not ['darwin', 'freebsd', 'dragonfly', 'windows'].contains(host_machine.system())
+ error('MESON_SKIP_TEST only applicable on macOS, FreeBSD, DragonflyBSD, and Windows.')
+endif
+
+cc = meson.get_compiler('c')
+
+if host_machine.system() == 'darwin' and cc.get_id() != 'clang'
+ # this will only work on mac if using Apple's clang compiler, but there is no
+ # way in the meson source level to differentiate apple clang and llvm clang
+ # In the meson CI only apple clang is tested
+ error('MESON_SKIP_TEST on macOS only clang is supported.')
+endif
+
+if not (cc.find_library('z', required: false).found() or
+ cc.find_library('zlib', required : false).found() or
+ cc.find_library('zlib1', required : false).found())
+ error('MESON_SKIP_TEST Cannot seem to find zlib via find_library, this test will probably fail.')
+endif
+
+z = dependency('zlib', method : 'system')
+assert(z.version().version_compare('>= 1.2'), 'Version does not seem to have been detected correctly.')