From 7d8fb9ec7558bc2ffd89251cd25fb50b99b2fc57 Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Fri, 10 Jun 2022 12:57:21 +0200 Subject: [PATCH] Wimplicit_fallthrough requires gcc7 or newer, so only enable it there. Also disable -Werror, as this is a great annoyance and breaks the build with (newer) gccs or when some hardening options are enabled. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48fb79d..fa27581 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,11 @@ set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointe set(CMAKE_C_FLAGS_LTO "${CMAKE_C_FLAGS_RELEASE} -flto") set(CMAKE_EXE_LINKER_FLAGS_LTO "${CMAKE_LINKER_FLAGS_RELEASE} -flto") -add_compile_options(-Wall -Wextra -Werror -Werror -Wno-implicit-fallthrough) +add_compile_options(-Wall -Wextra) + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 7) + add_compile_option(-Wno-implicit-fallthrough) +endif() if (NOT DISABLE_CLIENT) SET(C_SRCS