From c75ed6b2eb903e781fbf0807d364eca7450ae222 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Thu, 28 Sep 2023 21:04:37 +0900 Subject: [PATCH] Define -Wno-unsafe-buffer-usage for clang-17+ --- CMakeLists.txt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bce9c326a..c6c36847c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -972,14 +972,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") "-Weverything -Werror -Wno-poison-system-directories -Wno-padded -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-documentation -Wno-unused-member-function" ) - if(EMSCRIPTEN) - # Recent `latest` emscripten(as of 2023 May 5. clang17) - # seems enable -Wunsafe-buffer-usage when `-Weverything` is defined, - # resulting compilation error for some raw array access without bound check. - # - # https://reviews.llvm.org/D138940 - # - # we need to suppress it as a work around. + # clang17 seems enable -Wunsafe-buffer-usage when `-Weverything` is defined, + # resulting compilation error for some raw array access without bound check. + # https://reviews.llvm.org/D138940 + # we need to suppress it as a work around. + if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 16) set(TUSDZ_COMPILE_FLAGS "${TUSDZ_COMPILE_FLAGS} -Wno-unsafe-buffer-usage") endif()