From 65d4a0a8cd5c59ebdd36a20f9f70f174acf5867d Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Tue, 14 Mar 2017 14:29:09 +0100 Subject: [PATCH] Add ASAN option to CMake --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef1743df7a..2ea0fc8f34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ include(CheckCXXSourceCompiles) option(WITH_TESTS "Enable building of unit tests" ON) option(WITH_GUI_TESTS "Enable building of GUI tests" OFF) option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF) +option(WITH_ASAN "Enable address sanitizer checks" OFF) option(WITH_COVERAGE "Use to build with coverage tests. (GCC ONLY)." OFF) option(WITH_XC_AUTOTYPE "Include Auto-Type." ON) @@ -83,6 +84,9 @@ endif() add_gcc_compiler_cxxflags("-fno-exceptions -fno-rtti") add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual") add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings") +if(WITH_ASAN) + add_gcc_compiler_flags("-fsanitize=address") +endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER) if (CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")