Skip to content

Commit

Permalink
unittest: add COMPILER_WARNINGS_AS_ERRORS handling
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
fabiobaltieri committed Dec 12, 2024
1 parent 1a12288 commit 0dc50ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/modules/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,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()
Expand Down

0 comments on commit 0dc50ad

Please sign in to comment.