[balsa] meson.build: Conditionally add FORTIFY_SOURCE



commit 3425196ed6af323ebd6b3a44920c59707b9bb87a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Dec 5 19:25:56 2020 -0500

    meson.build: Conditionally add FORTIFY_SOURCE
    
    Define the FORTIFY_SOURCE macro only if the optimization level is at
    least 2. Fixes https://gitlab.gnome.org/GNOME/balsa/-/issues/49

 meson.build | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index b7190fe34..7431969cc 100644
--- a/meson.build
+++ b/meson.build
@@ -448,7 +448,7 @@ endif # more_warnings
 # extra warnings for GIT.
 #
 if balsa_from_git
-  args = compiler.get_supported_arguments([
+  args = [
     '-Werror',
     '-Wdeprecated-declarations',
     '-Wredundant-decls',
@@ -461,10 +461,15 @@ if balsa_from_git
     '-DGTK_DISABLE_DEPRECATED',
     '-DNM_DISABLE_DEPRECATED',
     '-DPANGO_DISABLE_DEPRECATED',
-    '-U_FORTIFY_SOURCE',
-    '-D_FORTIFY_SOURCE=2',
-  ])
-  add_global_arguments(args, language : 'c')
+    ]
+  if get_option('optimization').to_int() >= 2
+    message('Add FORTIFY_SOURCE macro')
+    args += [
+      '-U_FORTIFY_SOURCE',
+      '-D_FORTIFY_SOURCE=2',
+      ]
+  endif # get_option('optimization') >= 2
+  add_global_arguments(compiler.get_supported_arguments(args), language : 'c')
 endif # balsa_from_git
 
 ###########################################################################


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]