Commit 1abae91 1 parent 4af241b commit 1abae91 Copy full SHA for 1abae91
File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,11 @@ if(SECP256K1_BUILD_CTIME_TESTS)
269
269
unset (msan_enabled)
270
270
endif ()
271
271
272
+ if (NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
273
+ include (TryAppendLinkerFlags)
274
+ try_append_linker_flags(-Wl,--no -undefined)
275
+ endif ()
276
+
272
277
include (CTest)
273
278
# We do not use CTest's BUILD_TESTING because a single toggle for all tests is too coarse for our needs.
274
279
mark_as_advanced (BUILD_TESTING)
Original file line number Diff line number Diff line change
1
+ include_guard (GLOBAL )
2
+
3
+ include (CheckCSourceCompiles)
4
+
5
+ function (secp256k1_check_linker_flags_internal flags output )
6
+ string (MAKE_C_IDENTIFIER "${flags} " result)
7
+ string (TOUPPER "${result} " result)
8
+ set (result "LINKER_SUPPORTS_${result} " )
9
+ set (CMAKE_REQUIRED_FLAGS "${flags} " )
10
+ if (MSVC )
11
+ string (APPEND " /WX" )
12
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
13
+ string (APPEND " -Wl,-fatal_warnings" )
14
+ else ()
15
+ string (APPEND " -Wl,--fatal-warnings" )
16
+ endif ()
17
+
18
+ # This ensures running a linker.
19
+ set (CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
20
+ check_c_source_compiles("int main() { return 0; }" ${result} )
21
+
22
+ set (${output} ${${result} } PARENT_SCOPE)
23
+ endfunction ()
24
+
25
+ # Append flags to the LINK_OPTIONS directory property if a linker accepts them.
26
+ macro (try_append_linker_flags)
27
+ secp256k1_check_linker_flags_internal("${ARGV} " result)
28
+ if (result)
29
+ add_link_options (${ARGV} )
30
+ endif ()
31
+ unset (result)
32
+ endmacro ()
You can’t perform that action at this time.
0 commit comments