Skip to content

Commit 837e004

Browse files
authored
Conditionally check the compiler flags in libs.native (#109228)
1 parent cd63781 commit 837e004

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/native/libs/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,14 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
126126
add_compile_options(-Wno-empty-translation-unit)
127127
add_compile_options(-Wno-cast-align)
128128
add_compile_options(-Wno-typedef-redefinition)
129-
add_compile_options(-Wno-c11-extensions)
130-
add_compile_options(-Wno-pre-c11-compat) # fixes build on Debian
131-
add_compile_options(-Wno-unknown-warning-option) # unknown warning option '-Wno-pre-c11-compat'
132129
add_compile_options(-Wno-thread-safety-analysis)
130+
add_compile_options(-Wno-c11-extensions)
131+
132+
check_c_compiler_flag(-Wpre-c11-compat COMPILER_SUPPORTS_W_PRE_C11_COMPAT)
133+
if (COMPILER_SUPPORTS_W_PRE_C11_COMPAT)
134+
add_compile_options(-Wno-pre-c11-compat)
135+
endif()
136+
133137
if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
134138
add_compile_options(-Wno-unsafe-buffer-usage)
135139
add_compile_options(-Wno-cast-function-type-strict)

0 commit comments

Comments
 (0)