meson: Don't set _FORTIFY_SOURCE for ChromeOS
ChromeOS is moving to a platform default of `_FORTIFY_SOURCE=3`, and this definition conflicts with that: <command line>:4:9: error: '_FORTIFY_SOURCE' macro redefined [-Werror,-Wmacro-redefined] Rather than adding logic to keep up with their local configuration, it seems best to leave setting _FORTIFY_SOURCE on ChromeOS up to ChromeOS. Signed-off-by: George Burgess IV <gbiv@google.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
90e0fea6c6
commit
9c5eb9237c
1 changed files with 19 additions and 5 deletions
18
meson.build
18
meson.build
|
@ -99,13 +99,27 @@ if cc.get_id() == 'clang'
|
||||||
error('clang version is too old, libcamera requires 9.0 or newer')
|
error('clang version is too old, libcamera requires 9.0 or newer')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Turn _FORTIFY_SOURCE by default on optimised builds (as it requires -O1
|
# Turn _FORTIFY_SOURCE by default on. This is needed on clang only as gcc
|
||||||
# or higher). This is needed on clang only as gcc enables it by default.
|
# enables it by default. FORTIFY will not work properly with `-O0`, and may
|
||||||
|
# result in macro redefinition errors if the user already has a setting for
|
||||||
|
# `-D_FORTIFY_SOURCE`. Do not enable FORTIFY in either of those cases.
|
||||||
if get_option('optimization') != '0'
|
if get_option('optimization') != '0'
|
||||||
|
has_fortify_define = false
|
||||||
|
# Assume that if the user requests a FORTIFY level in cpp_args, they
|
||||||
|
# do the same for c_args.
|
||||||
|
foreach flag : get_option('cpp_args')
|
||||||
|
if flag == '-U_FORTIFY_SOURCE'
|
||||||
|
has_fortify_define = false
|
||||||
|
elif flag.startswith('-D_FORTIFY_SOURCE=')
|
||||||
|
has_fortify_define = true
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
if not has_fortify_define
|
||||||
common_arguments += [
|
common_arguments += [
|
||||||
'-D_FORTIFY_SOURCE=2',
|
'-D_FORTIFY_SOURCE=2',
|
||||||
]
|
]
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Use libc++ by default if available instead of libstdc++ when compiling
|
# Use libc++ by default if available instead of libstdc++ when compiling
|
||||||
# with clang.
|
# with clang.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue