sysbuild: Add support for COMPILER_WARNINGS_AS_ERRORS
Adds support for the Kconfig option to enable compiler warnings being treated as errors in all images that are build. This is a sticky-set option which means enabling it in sysbuild will enable it in all images, if it is then disabled in sysbuild it will not be disabled in any of the images as a result and would need to be manually unselected. Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
parent
1861583ce2
commit
9f71b8023b
|
@ -42,3 +42,9 @@ config WARN_DEPRECATED
|
||||||
features are enabled.
|
features are enabled.
|
||||||
|
|
||||||
rsource "images/Kconfig"
|
rsource "images/Kconfig"
|
||||||
|
|
||||||
|
menu "Build options"
|
||||||
|
|
||||||
|
rsource "build/Kconfig"
|
||||||
|
|
||||||
|
endmenu
|
||||||
|
|
8
share/sysbuild/build/Kconfig
Normal file
8
share/sysbuild/build/Kconfig
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config COMPILER_WARNINGS_AS_ERRORS
|
||||||
|
bool "Treat warnings as errors"
|
||||||
|
help
|
||||||
|
Turn on "warning as error" toolchain flags for all images if set.
|
|
@ -372,11 +372,14 @@ function(ExternalZephyrProject_Add)
|
||||||
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES MAIN_APP True)
|
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES MAIN_APP True)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(image_default "${CMAKE_SOURCE_DIR}/image_configurations/ALL_image_default.cmake")
|
||||||
|
|
||||||
if(DEFINED ZBUILD_APP_TYPE)
|
if(DEFINED ZBUILD_APP_TYPE)
|
||||||
set(image_default "${CMAKE_SOURCE_DIR}/image_configurations/${ZBUILD_APP_TYPE}_image_default.cmake")
|
list(APPEND image_default "${CMAKE_SOURCE_DIR}/image_configurations/${ZBUILD_APP_TYPE}_image_default.cmake")
|
||||||
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES IMAGE_CONF_SCRIPT ${image_default})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES IMAGE_CONF_SCRIPT "${image_default}")
|
||||||
|
|
||||||
if(DEFINED ZBUILD_BOARD)
|
if(DEFINED ZBUILD_BOARD)
|
||||||
# Only set image specific board if provided.
|
# Only set image specific board if provided.
|
||||||
# The sysbuild BOARD is exported through sysbuild cache, and will be used
|
# The sysbuild BOARD is exported through sysbuild cache, and will be used
|
||||||
|
|
10
share/sysbuild/image_configurations/ALL_image_default.cmake
Normal file
10
share/sysbuild/image_configurations/ALL_image_default.cmake
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Copyright (c) 2024 Nordic Semiconductor
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# This sysbuild CMake file sets the sysbuild controlled settings as properties
|
||||||
|
# on all images.
|
||||||
|
|
||||||
|
if(SB_CONFIG_COMPILER_WARNINGS_AS_ERRORS)
|
||||||
|
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_COMPILER_WARNINGS_AS_ERRORS y)
|
||||||
|
endif()
|
Loading…
Reference in a new issue