Skip to content

Commit

Permalink
cmake: add option to enable/disable -Werror
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfalkenberg committed Nov 21, 2023
1 parent b28c94b commit cb581e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit cb581e3

Please sign in to comment.