From 480e33432e20990f4555209ea8f357a3b7cd0148 Mon Sep 17 00:00:00 2001 From: faluco Date: Mon, 17 Jun 2024 10:38:14 +0200 Subject: [PATCH] Disable array-bounds checking without assertions to avoid false positives detected when compiling with GCC --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac45644076..4836159537 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,12 @@ if (ENABLE_WERROR) if (HAS_STRINGOP_OVERFLOW) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=stringop-overflow") endif() + if (ASSERT_LEVEL STREQUAL "MINIMAL") + check_cxx_compiler_flag("-Warray-bounds" HAS_ARRAY_BOUNDS) + if (HAS_ARRAY_BOUNDS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=array-bounds") + endif() + endif() endif() endif ()