From cb581e3b555cecd40c68d85f72a2b4f787e86131 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Fri, 10 Nov 2023 10:05:51 +0100 Subject: [PATCH] cmake: add option to enable/disable -Werror --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61ef69737..579a14c04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,7 @@ option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF) option(ENABLE_SRSLOG_TRACING "Enable event tracing using srslog" OFF) option(ASSERTS_ENABLED "Enable srsRAN asserts" ON) option(STOP_ON_WARNING "Interrupt application on warning" OFF) +option(ENABLE_WERROR "Stop compilation on errors" ON) option(ENABLE_ALL_TEST "Enable all unit/component test" OFF) @@ -525,7 +526,7 @@ if("Ninja" STREQUAL ${CMAKE_GENERATOR}) endif() # Add -Werror to C/C++ flags for newer compilers -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) +if(ENABLE_WERROR AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") endif()