From 0dc50adf7b6c55431a8915b4cd033bd4375ad0a0 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Thu, 12 Dec 2024 16:21:44 +0000 Subject: [PATCH] unittest: add COMPILER_WARNINGS_AS_ERRORS handling Add a check to set the warnings_as_errors flags in unit tests if CONFIG_COMPILER_WARNINGS_AS_ERRORS is specified, this should catch warnings in unit test twister runs. Signed-off-by: Fabio Baltieri --- cmake/modules/unittest.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/modules/unittest.cmake b/cmake/modules/unittest.cmake index 6565e89aec53a77..eac854bb32698b3 100644 --- a/cmake/modules/unittest.cmake +++ b/cmake/modules/unittest.cmake @@ -130,6 +130,10 @@ if(CONFIG_COVERAGE) target_link_libraries(testbinary PRIVATE $) endif() +if (CONFIG_COMPILER_WARNINGS_AS_ERRORS) + target_compile_options(test_interface INTERFACE $) +endif() + if(LIBS) message(FATAL_ERROR "This variable is not supported, see SOURCES instead") endif()