diff options
author | Pieter Wuille <pieter@wuille.net> | 2023-06-21 11:04:00 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2023-06-21 11:04:00 -0400 |
commit | a143a12d44a592083b3cc1a9a2eb33272186ad0a (patch) | |
tree | 75f138950da43c894f693c40cf3c5f3d375b9e7a /src/secp256k1/cmake/TryAppendCFlags.cmake | |
parent | d23cdf659e147e7040a3924fc20cfaf639bbf5db (diff) | |
parent | 901336eee751de088465e313dd8b500dfaf462b2 (diff) | |
download | bitcoin-a143a12d44a592083b3cc1a9a2eb33272186ad0a.tar.xz |
Update src/secp256k1 subtree to version with ElligatorSwift support
Diffstat (limited to 'src/secp256k1/cmake/TryAppendCFlags.cmake')
-rw-r--r-- | src/secp256k1/cmake/TryAppendCFlags.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/secp256k1/cmake/TryAppendCFlags.cmake b/src/secp256k1/cmake/TryAppendCFlags.cmake new file mode 100644 index 0000000000..1d81a9317a --- /dev/null +++ b/src/secp256k1/cmake/TryAppendCFlags.cmake @@ -0,0 +1,24 @@ +include(CheckCCompilerFlag) + +function(secp256k1_check_c_flags_internal flags output) + string(MAKE_C_IDENTIFIER "${flags}" result) + string(TOUPPER "${result}" result) + set(result "C_SUPPORTS_${result}") + if(NOT MSVC) + set(CMAKE_REQUIRED_FLAGS "-Werror") + endif() + + # This avoids running a linker. + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + check_c_compiler_flag("${flags}" ${result}) + + set(${output} ${${result}} PARENT_SCOPE) +endfunction() + +# Append flags to the COMPILE_OPTIONS directory property if CC accepts them. +macro(try_append_c_flags) + secp256k1_check_c_flags_internal("${ARGV}" result) + if(result) + add_compile_options(${ARGV}) + endif() +endmacro() |