diff options
Diffstat (limited to 'zephyr/cmake/compiler/clang/compiler_flags.cmake')
-rw-r--r-- | zephyr/cmake/compiler/clang/compiler_flags.cmake | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/zephyr/cmake/compiler/clang/compiler_flags.cmake b/zephyr/cmake/compiler/clang/compiler_flags.cmake index f24e1f1f4c..2fffd4b755 100644 --- a/zephyr/cmake/compiler/clang/compiler_flags.cmake +++ b/zephyr/cmake/compiler/clang/compiler_flags.cmake @@ -9,18 +9,20 @@ set_compiler_property(PROPERTY hosted) # Disable position independent code. if ("${ARCH}" STREQUAL "posix" OR "${ARCH}" STREQUAL "unit_testing") - add_compile_options(-fPIC) + add_compile_options(-fPIC) else() - add_compile_options(-fno-PIC) + 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) +if(DEFINED CONFIG_COMPILER_WARNINGS_AS_ERRORS) + 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) +endif() # clang flags for coverage generation set_property(TARGET compiler PROPERTY coverage --coverage -fno-inline) |