Skip to content

Commit 1e97094

Browse files
committed
cmake: Fix checking compiler flags like -Wno-some-warning
1 parent 908e02d commit 1e97094

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmake/TryAppendCFlags.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ function(secp256k1_check_c_flags_internal flags output)
1010

1111
# This avoids running a linker.
1212
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
13-
check_c_compiler_flag("${flags}" ${result})
13+
14+
# Some compilers (GCC) produce no diagnostic for -Wno-unknown-warning
15+
# unless other diagnostics are being produced. Therefore, test the
16+
# -Wsome-warning case instead of the -Wno-some-warning one.
17+
string(REPLACE "-Wno-" "-W" non_negated_flags "${flags}")
18+
19+
check_c_compiler_flag("${non_negated_flags}" ${result})
1420

1521
set(${output} ${${result}} PARENT_SCOPE)
1622
endfunction()

0 commit comments

Comments
 (0)