git-subtree-dir: external/nng git-subtree-split: 29b73962b939a6fbbf6ea8d5d7680bb06d0eeb99
30 lines
1.2 KiB
CMake
30 lines
1.2 KiB
CMake
#
|
|
# Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
|
|
# Copyright 2017 Capitar IT Group BV <info@capitar.com>
|
|
#
|
|
# This software is supplied under the terms of the MIT License, a
|
|
# copy of which should be located in the distribution where this
|
|
# file was obtained (LICENSE.txt). A copy of the license may also be
|
|
# found online at https://opensource.org/licenses/MIT.
|
|
#
|
|
|
|
macro (CheckSanitizer)
|
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
set(NNG_SAN_LIST none address leak memory thread undefined)
|
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
set(NNG_SAN_LIST none address leak memory thread undefined)
|
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
|
set(NNG_SAN_LIST none address thread undefined)
|
|
else ()
|
|
set(NNG_SAN_LIST none)
|
|
endif ()
|
|
set (NNG_SANITIZER none CACHE STRING "Sanitizer to use (clang or gcc).")
|
|
set_property(CACHE NNG_SANITIZER PROPERTY STRINGS ${NNG_SAN_LIST})
|
|
mark_as_advanced (NNG_SANITIZER)
|
|
|
|
if (NOT NNG_SANITIZER STREQUAL "none")
|
|
set (NNG_C_FLAG_SANITIZER "-fsanitize=${NNG_SANITIZER}")
|
|
message(STATUS "Enabling sanitizer: ${NNG_C_FLAG_SANITIZER}")
|
|
endif()
|
|
endmacro ()
|