From 7d0b258be2130f1ec420ae586d51cc0b497f5044 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 19 Jun 2018 14:41:04 +0100 Subject: 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 -- cgit v1.2.1