[libcamera-devel] [PATCH] meson: Define _FORTIFY_SOURCE for non-debug builds

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Aug 19 15:02:45 CEST 2019


_FORTIFY_SOURCE add useful checks during compilation. Enable it by
default, except for debug builds as it requires at least a -O1
optimisation level.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meson.build b/meson.build
index 13d0605f903c..53263d68791d 100644
--- a/meson.build
+++ b/meson.build
@@ -35,6 +35,12 @@ common_arguments = [
     '-include', 'config.h',
 ]
 
+if get_option('buildtype') != 'debug'
+    common_arguments += [
+        '-D_FORTIFY_SOURCE=1',
+    ]
+endif
+
 c_arguments = common_arguments
 cpp_arguments = common_arguments
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list