aboutsummaryrefslogtreecommitdiff
path: root/src/secp256k1/cmake/CheckMemorySanitizer.cmake
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-06-25 15:01:00 +0100
committerfanquake <fanquake@gmail.com>2024-06-25 15:01:00 +0100
commitcc58e958f341d2759fbabe5c9d8cc557e17d587f (patch)
treea0bdd2f8083579292b338aaca54fe2c7f5900918 /src/secp256k1/cmake/CheckMemorySanitizer.cmake
parent323b0acfcb9380ce4b3c12a3d0b341d7bb3bfe08 (diff)
parent1408944d2ec9f78e62bf91a5e5a50317ba3060c5 (diff)
Update secp256k1 subtree to latest master
Diffstat (limited to 'src/secp256k1/cmake/CheckMemorySanitizer.cmake')
-rw-r--r--src/secp256k1/cmake/CheckMemorySanitizer.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/secp256k1/cmake/CheckMemorySanitizer.cmake b/src/secp256k1/cmake/CheckMemorySanitizer.cmake
new file mode 100644
index 0000000000..d9ef681e65
--- /dev/null
+++ b/src/secp256k1/cmake/CheckMemorySanitizer.cmake
@@ -0,0 +1,18 @@
+include_guard(GLOBAL)
+include(CheckCSourceCompiles)
+
+function(check_memory_sanitizer output)
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+ check_c_source_compiles("
+ #if defined(__has_feature)
+ # if __has_feature(memory_sanitizer)
+ /* MemorySanitizer is enabled. */
+ # elif
+ # error \"MemorySanitizer is disabled.\"
+ # endif
+ #else
+ # error \"__has_feature is not defined.\"
+ #endif
+ " HAVE_MSAN)
+ set(${output} ${HAVE_MSAN} PARENT_SCOPE)
+endfunction()