diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 9f1a1cf30a..d8a0cf25b8 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -42,3 +42,9 @@ config WARN_DEPRECATED features are enabled. rsource "images/Kconfig" + +menu "Build options" + +rsource "build/Kconfig" + +endmenu diff --git a/share/sysbuild/build/Kconfig b/share/sysbuild/build/Kconfig new file mode 100644 index 0000000000..dfa423cd3e --- /dev/null +++ b/share/sysbuild/build/Kconfig @@ -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. diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index 05cde48a0e..40f73d26da 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -372,11 +372,14 @@ function(ExternalZephyrProject_Add) set_target_properties(${ZBUILD_APPLICATION} PROPERTIES MAIN_APP True) endif() + set(image_default "${CMAKE_SOURCE_DIR}/image_configurations/ALL_image_default.cmake") + if(DEFINED ZBUILD_APP_TYPE) - set(image_default "${CMAKE_SOURCE_DIR}/image_configurations/${ZBUILD_APP_TYPE}_image_default.cmake") - set_target_properties(${ZBUILD_APPLICATION} PROPERTIES IMAGE_CONF_SCRIPT ${image_default}) + list(APPEND image_default "${CMAKE_SOURCE_DIR}/image_configurations/${ZBUILD_APP_TYPE}_image_default.cmake") endif() + set_target_properties(${ZBUILD_APPLICATION} PROPERTIES IMAGE_CONF_SCRIPT "${image_default}") + if(DEFINED ZBUILD_BOARD) # Only set image specific board if provided. # The sysbuild BOARD is exported through sysbuild cache, and will be used diff --git a/share/sysbuild/image_configurations/ALL_image_default.cmake b/share/sysbuild/image_configurations/ALL_image_default.cmake new file mode 100644 index 0000000000..d270704ad5 --- /dev/null +++ b/share/sysbuild/image_configurations/ALL_image_default.cmake @@ -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()