diff --git a/CMakeLists.txt b/CMakeLists.txt index 87ab6c762..afaf99424 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,14 +74,15 @@ else() $<$:-Woverloaded-virtual> $<$:-Wold-style-cast> ) - option(BUILD_WERROR "Build with -Werror" ON) - if(BUILD_WERROR) - list(APPEND COMPILE_OPTIONS -Werror) - endif() endif() add_compile_options(${COMPILE_OPTIONS}) +option(BUILD_WERROR "Build with -Werror" OFF) +if(BUILD_WERROR) + set(CMAKE_COMPILE_WARNING_AS_ERROR ON) +endif() + if(CMAKE_BUILD_TYPE MATCHES "Release") add_definitions(-DNDEBUG) set(ENABLE_DEBUG_OUTPUT_DEFAULT OFF)