Skip to content

Commit

Permalink
cmake: Fix checking compiler flags like -Wno-some-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed May 30, 2023
1 parent 908e02d commit 1e97094
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmake/TryAppendCFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ function(secp256k1_check_c_flags_internal flags output)

# This avoids running a linker.
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
check_c_compiler_flag("${flags}" ${result})

# Some compilers (GCC) produce no diagnostic for -Wno-unknown-warning
# unless other diagnostics are being produced. Therefore, test the
# -Wsome-warning case instead of the -Wno-some-warning one.
string(REPLACE "-Wno-" "-W" non_negated_flags "${flags}")

check_c_compiler_flag("${non_negated_flags}" ${result})

set(${output} ${${result}} PARENT_SCOPE)
endfunction()
Expand Down

0 comments on commit 1e97094

Please sign in to comment.