From cf5bee84c3353952d1cb45525625d17ea37d5e17 Mon Sep 17 00:00:00 2001 From: Tom Huang Date: Sun, 29 Jun 2025 15:42:35 -0700 Subject: [PATCH] fix: only treat warnings as errors in newer gcc The gcc versions older than 4.3 cannot build the current code base without warnings, which are treated as errors, hence cannot build argtable3. Besides, these old versions cannot enforce standard compliance properly. In this patch, we enhance the CMakeList.txt script so we don't treat warnings as errors in very old gcc versions. --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 337bb81..2b6d305 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,9 +46,9 @@ else(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - if ((CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2) + if ((CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.3) OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic") endif() endif()