From 33d379a7b1d8b91d1281519009d2709a5bd3a1b6 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Fri, 25 Oct 2024 19:25:34 +0300 Subject: [PATCH] Conditionally check the compiler flags in libs.native --- src/native/libs/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt index 23bdf3c26d37a..59cc76cb46dbd 100644 --- a/src/native/libs/CMakeLists.txt +++ b/src/native/libs/CMakeLists.txt @@ -123,10 +123,14 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) add_compile_options(-Wno-empty-translation-unit) add_compile_options(-Wno-cast-align) add_compile_options(-Wno-typedef-redefinition) - add_compile_options(-Wno-c11-extensions) - add_compile_options(-Wno-pre-c11-compat) # fixes build on Debian - add_compile_options(-Wno-unknown-warning-option) # unknown warning option '-Wno-pre-c11-compat' add_compile_options(-Wno-thread-safety-analysis) + add_compile_options(-Wno-c11-extensions) + + check_c_compiler_flag(-Wpre-c11-compat COMPILER_SUPPORTS_W_PRE_C11_COMPAT) + if (COMPILER_SUPPORTS_W_PRE_C11_COMPAT) + add_compile_options(-Wno-pre-c11-compat) + endif() + if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) add_compile_options(-Wno-unsafe-buffer-usage) add_compile_options(-Wno-cast-function-type-strict)