meson: Enable _FORTIFY_SOURCE for optimized builds

Otherwise we are going to get warnings from the C library.
This commit is contained in:
Emmanuele Bassi 2021-08-15 19:12:49 +01:00
parent 8b5e285e26
commit 8ee4d5f1d3

View file

@ -70,7 +70,9 @@ if cc.get_id() != 'msvc'
'-fno-common'
]
cflags += '-Wp,-D_FORTIFY_SOURCE=2'
if get_option('optimization') in ['1', '2', '3']
cflags += '-Wp,-D_FORTIFY_SOURCE=2'
endif
supported_cflags = cc.get_supported_arguments(cflags)
add_project_arguments(supported_cflags, language: 'c')