From a3ba1ad369bef4eb57b2dd48b8d632eb495e2610 Mon Sep 17 00:00:00 2001 From: "Hong, Yang A" Date: Tue, 5 Jul 2022 17:11:18 +0000 Subject: [PATCH] gcc-10(and above): fix compile issue caused by stringop-overflow --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bc6077f..5ff2c9ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -427,9 +427,9 @@ CHECK_CXX_COMPILER_FLAG("-Wunused-local-typedefs" CXX_UNUSED_LOCAL_TYPEDEFS) CHECK_CXX_COMPILER_FLAG("-Wunused-variable" CXX_WUNUSED_VARIABLE) # gcc 10 complains about this -CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW) -if(CC_STRINGOP_OVERFLOW) +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10) set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow") + set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-stringop-overflow") endif() endif()