Commit e9b86891 authored by Fabio Baltieri's avatar Fabio Baltieri Committed by Benjamin Cabé
Browse files

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: default avatarFabio Baltieri <fabiobaltieri@google.com>
parent e510275c
Loading
Loading
Loading
Loading
+4 −0
Changes for cmake/modules/unittest.cmake: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -131,6 +131,10 @@ if(CONFIG_COVERAGE)
  target_link_libraries(testbinary PRIVATE $<TARGET_PROPERTY:linker,coverage>)
endif()

if (CONFIG_COMPILER_WARNINGS_AS_ERRORS)
  target_compile_options(test_interface INTERFACE $<TARGET_PROPERTY:compiler,warnings_as_errors>)
endif()

if(LIBS)
  message(FATAL_ERROR "This variable is not supported, see SOURCES instead")
endif()