From 3ab86657041d46d32eb7cd2b8791bb2c8d6160a6 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 19 Jun 2018 14:41:04 +0100 Subject: [PATCH] build: Use Meson to test for compiler and linker arguments Instead of iterating over them ourselves, Meson 0.46 provides useful convenience functions. Using the appropriate Meson functions also removes warnings with newer versions of Meson. --- meson.build | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 5f68bcf..c7512e0 100644 --- a/meson.build +++ b/meson.build @@ -65,19 +65,12 @@ if get_option('default_library') != 'static' endif # Check all compiler flags -foreach cflag: test_cflags - if cc.has_argument(cflag) - common_cflags += [ cflag ] - endif -endforeach +common_cflags += cc.get_supported_arguments(test_cflags) # Linker flags if host_machine.system() == 'linux' - foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] - if cc.has_argument(ldflag) - common_ldflags += [ ldflag ] - endif - endforeach + test_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + common_ldflags += cc.get_supported_link_arguments(test_ldflags) endif # Maintain compatibility with autotools on macOS -- 2.11.4.GIT