Fix build issues due to updated arm-sdk
Due to recent changes made in arm-sdk,
the FORTIFY_SOURCE security flag enables optimization level 2.
The repo has a default debug level of optimization which conflicts with
FORTIFY_SOURCE flag.
In this commit the default build type is set to debugoptimized and also made sure
to disable the FORTIFY_SOURCE when we need to build without any optimization.
Signed-off-by: PriyangaRamasamy <priyanga24@in.ibm.com>
Change-Id: Ic1a91e58253fed283f67c44989fbc9126e18b7fe
diff --git a/meson.build b/meson.build
index 32775ad..548f5ae 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,8 @@
default_options: [
'warning_level=3',
'werror=true',
- 'cpp_std=c++17'
+ 'cpp_std=c++17',
+ 'build=debugoptimized'
],
version: '1.0'
)
@@ -22,6 +23,13 @@
compiler.has_header('CLI/CLI.hpp')
compiler.has_header('nlohmann/json.hpp')
add_global_arguments('-Wno-psabi', language : ['c', 'cpp'])
+
+# Disable FORTIFY_SOURCE when compiling with no optimization
+if(get_option('optimization') == '0')
+ add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
+ message('Disabling FORTIFY_SOURCE as optimization is set to 0')
+endif
+
configure_file(output: 'config.h',
configuration :{
'INVENTORY_JSON_DEFAULT': '"'+get_option('INVENTORY_JSON_DEFAULT')+'"',