Merge pull request #6811 from ethereum/cmake-sanitizer

cmake: Minor refactoring of SANITIZE flag
This commit is contained in:
chriseth 2019-05-22 13:08:22 +02:00 committed by GitHub
commit 1b6bd72e70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,13 @@ else ()
endif ()
if (SANITIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=${SANITIZE}")
# Perform case-insensitive string compare
string(TOLOWER "${SANITIZE}" san)
# -fno-omit-frame-pointer gives more informative stack trace in case of an error
# -fsanitize-address-use-after-scope throws an error when a variable is used beyond its scope
if (san STREQUAL "address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope")
endif()
endif()
# Code coverage support.