blob: f24e1f1f4c29a6abfee75bef14d5fa2b522f9d21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
include("${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake")
# Disable -fno-freestanding.
set_compiler_property(PROPERTY hosted)
# Disable position independent code.
if ("${ARCH}" STREQUAL "posix" OR "${ARCH}" STREQUAL "unit_testing")
add_compile_options(-fPIC)
else()
add_compile_options(-fno-PIC)
endif()
# When testing, look for stack smashing
add_compile_option_ifdef(CONFIG_ZTEST -fstack-protector-all)
check_set_compiler_property(APPEND PROPERTY warning_extended -Wunused-variable
-Werror=unused-variable -Werror=missing-braces
-Werror=sometimes-uninitialized -Werror=unused-function
-Werror=array-bounds)
# clang flags for coverage generation
set_property(TARGET compiler PROPERTY coverage --coverage -fno-inline)
|