cmake, refactor: Rename try_add_compile_option to try_append_cflags

Actually, `try_append_cflags()` can handle a list of flags, and the new
name is similar to the one used in `configure.ac`.
This commit is contained in:
Hennadii Stepanov 2023-03-22 10:35:49 +00:00
parent 19516ed3e9
commit 6ece1507cb
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
2 changed files with 18 additions and 18 deletions

View File

@ -191,25 +191,25 @@ else()
endif()
endif()
include(TryAddCompileOption)
include(TryAppendCFlags)
if(MSVC)
try_add_compile_option(/W2)
try_add_compile_option(/wd4146)
try_append_c_flags(/W2)
try_append_c_flags(/wd4146)
else()
try_add_compile_option(-pedantic)
try_add_compile_option(-Wall)
try_add_compile_option(-Wcast-align)
try_add_compile_option(-Wcast-align=strict)
try_add_compile_option(-Wconditional-uninitialized)
try_add_compile_option(-Wextra)
try_add_compile_option(-Wnested-externs)
try_add_compile_option(-Wno-long-long)
try_add_compile_option(-Wno-overlength-strings)
try_add_compile_option(-Wno-unused-function)
try_add_compile_option(-Wreserved-identifier)
try_add_compile_option(-Wshadow)
try_add_compile_option(-Wstrict-prototypes)
try_add_compile_option(-Wundef)
try_append_c_flags(-pedantic)
try_append_c_flags(-Wall)
try_append_c_flags(-Wcast-align)
try_append_c_flags(-Wcast-align=strict)
try_append_c_flags(-Wconditional-uninitialized)
try_append_c_flags(-Wextra)
try_append_c_flags(-Wnested-externs)
try_append_c_flags(-Wno-long-long)
try_append_c_flags(-Wno-overlength-strings)
try_append_c_flags(-Wno-unused-function)
try_append_c_flags(-Wreserved-identifier)
try_append_c_flags(-Wshadow)
try_append_c_flags(-Wstrict-prototypes)
try_append_c_flags(-Wundef)
endif()
set(CMAKE_C_VISIBILITY_PRESET hidden)

View File

@ -16,7 +16,7 @@ function(secp256k1_check_c_flags_internal flags output)
endfunction()
# Append flags to the COMPILE_OPTIONS directory property if CC accepts them.
macro(try_add_compile_option)
macro(try_append_c_flags)
secp256k1_check_c_flags_internal("${ARGV}" result)
if(result)
add_compile_options(${ARGV})