From 003d2d14688586c3a24b7cc4a0c6a7a40eb84425 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Tue, 18 Jun 2024 10:00:38 +0200 Subject: [PATCH] CMakeLists: Disable -Werror for 3rdparty/sqlite3.c We package vanilla sqlite from upstream and on Fedora 40 with sqlite 3.46 there's the following compiler warning: In function 'sqlite3Strlen30', inlined from 'sqlite3ColumnSetColl' at ../../src/3rdparty/sqlite3.c:122105:10: ../../src/3rdparty/sqlite3.c:35003:28: error: 'strlen' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread] 35003 | return 0x3fffffff & (int)strlen(z); | ^~~~~~~~~ In function 'sqlite3ColumnSetColl': Disabling -Werror on sqlite3.c seems sensible given we have little control over that code. --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb075c4d35..c7ae4f183c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,11 +45,13 @@ if (MSVC) # TODO: This is disabled for now because there a bunch of known # compiler warnings on Windows that we don't have good fixes for. #set(WERROR_FLAG "/WX") + #set(WNOERROR_FLAG "/WX:NO") endif () else () set(SIGN_COMPARE_FLAG "-Wno-sign-compare") if (BUILD_WITH_WERROR) set(WERROR_FLAG "-Werror") + set(WNOERROR_FLAG "-Wno-error") endif () endif () @@ -445,6 +447,10 @@ set(THIRD_PARTY_SRCS $<$:3rdparty/sqlite3.c> 3rdparty/strsep.c) +if (USE_SQLITE AND WNOERROR_FLAG) + set_source_files_properties(3rdparty/sqlite3.c PROPERTIES COMPILE_FLAGS ${WNOERROR_FLAG}) +endif () + # Highwayhash. Highwayhash is a bit special since it has architecture dependent # code... set(hhash_dir ${PROJECT_SOURCE_DIR}/auxil/highwayhash/highwayhash)