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 Jul 1, 2024
1 parent a526937 commit bad556a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmake/TryAppendCFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ 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-some-warning,
# if "some-warning" is unknown to the compiler and no 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 bad556a

Please sign in to comment.