From 4f835dff9b6cac46bc69870019379372945c97e6 Mon Sep 17 00:00:00 2001 From: Tobias Naumann Date: Mon, 8 May 2023 13:39:41 +0200 Subject: [PATCH] Only add -Wno-unused-but-set-variable flag when using clang >= 13.0.0 The flag is only available for clang versions >= 13.0.0 according to the manual for versions 12.0.1 and 13.0.0 - https://releases.llvm.org/12.0.1/tools/clang/docs/DiagnosticsReference.html - https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html --- mbedtls-sys/vendor/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mbedtls-sys/vendor/CMakeLists.txt b/mbedtls-sys/vendor/CMakeLists.txt index 1dcec6374..5beee5f1e 100644 --- a/mbedtls-sys/vendor/CMakeLists.txt +++ b/mbedtls-sys/vendor/CMakeLists.txt @@ -210,7 +210,10 @@ if(CMAKE_COMPILER_IS_GNU) endif(CMAKE_COMPILER_IS_GNU) if(CMAKE_COMPILER_IS_CLANG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-but-set-variable -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 13.0.0) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable") + endif() set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage")