diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-09-29 09:40:20 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-09-29 09:40:20 +0200 |
commit | 86640e8f91ff01ef3b409371deb7e2efe7d43593 (patch) | |
tree | d8fa8ab638382515e3552c4239793f4a5a41e514 /CMakeLists.txt | |
parent | c88dc805e55cffa7af83ae741b0ffa26aade068e (diff) | |
download | tigervnc-86640e8f91ff01ef3b409371deb7e2efe7d43593.tar.gz tigervnc-86640e8f91ff01ef3b409371deb7e2efe7d43593.zip |
Add address sanitizer switch
Useful for debugging memory leaks and access violations. It is
not available on Windows though, and there is some problem compiling
ObjectiveC++ with it turned on.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a46679b8..08ef25cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,12 @@ IF(CMAKE_BUILD_TYPE MATCHES Debug) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") ENDIF() +option(ENABLE_ASAN "Enable address sanitizer support" OFF) +if(ENABLE_ASAN AND NOT WIN32 AND NOT APPLE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") +endif() + if(NOT DEFINED BUILD_WINVNC) set(BUILD_WINVNC 1) endif() |