aboutsummaryrefslogtreecommitdiff
path: root/src/secp256k1/cmake/CheckMemorySanitizer.cmake
blob: d9ef681e658119045ece4bae6486c628be31cb73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()