Skip to content

Commit 6ece150

Browse files
committed
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`.
1 parent 19516ed commit 6ece150

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

CMakeLists.txt

+17-17
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,25 @@ else()
191191
endif()
192192
endif()
193193

194-
include(TryAddCompileOption)
194+
include(TryAppendCFlags)
195195
if(MSVC)
196-
try_add_compile_option(/W2)
197-
try_add_compile_option(/wd4146)
196+
try_append_c_flags(/W2)
197+
try_append_c_flags(/wd4146)
198198
else()
199-
try_add_compile_option(-pedantic)
200-
try_add_compile_option(-Wall)
201-
try_add_compile_option(-Wcast-align)
202-
try_add_compile_option(-Wcast-align=strict)
203-
try_add_compile_option(-Wconditional-uninitialized)
204-
try_add_compile_option(-Wextra)
205-
try_add_compile_option(-Wnested-externs)
206-
try_add_compile_option(-Wno-long-long)
207-
try_add_compile_option(-Wno-overlength-strings)
208-
try_add_compile_option(-Wno-unused-function)
209-
try_add_compile_option(-Wreserved-identifier)
210-
try_add_compile_option(-Wshadow)
211-
try_add_compile_option(-Wstrict-prototypes)
212-
try_add_compile_option(-Wundef)
199+
try_append_c_flags(-pedantic)
200+
try_append_c_flags(-Wall)
201+
try_append_c_flags(-Wcast-align)
202+
try_append_c_flags(-Wcast-align=strict)
203+
try_append_c_flags(-Wconditional-uninitialized)
204+
try_append_c_flags(-Wextra)
205+
try_append_c_flags(-Wnested-externs)
206+
try_append_c_flags(-Wno-long-long)
207+
try_append_c_flags(-Wno-overlength-strings)
208+
try_append_c_flags(-Wno-unused-function)
209+
try_append_c_flags(-Wreserved-identifier)
210+
try_append_c_flags(-Wshadow)
211+
try_append_c_flags(-Wstrict-prototypes)
212+
try_append_c_flags(-Wundef)
213213
endif()
214214

215215
set(CMAKE_C_VISIBILITY_PRESET hidden)

cmake/TryAddCompileOption.cmake cmake/TryAppendCFlags.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function(secp256k1_check_c_flags_internal flags output)
1616
endfunction()
1717

1818
# Append flags to the COMPILE_OPTIONS directory property if CC accepts them.
19-
macro(try_add_compile_option)
19+
macro(try_append_c_flags)
2020
secp256k1_check_c_flags_internal("${ARGV}" result)
2121
if(result)
2222
add_compile_options(${ARGV})

0 commit comments

Comments
 (0)