aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-09-29 09:40:20 +0200
committerPierre Ossman <ossman@cendio.se>2015-09-29 09:40:20 +0200
commit86640e8f91ff01ef3b409371deb7e2efe7d43593 (patch)
treed8fa8ab638382515e3552c4239793f4a5a41e514 /cmake
parentc88dc805e55cffa7af83ae741b0ffa26aade068e (diff)
downloadtigervnc-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 'cmake')
-rw-r--r--cmake/StaticBuild.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake
index cc03487b..25c10777 100644
--- a/cmake/StaticBuild.cmake
+++ b/cmake/StaticBuild.cmake
@@ -109,6 +109,9 @@ if(BUILD_STATIC)
# This ensures that we don't depend on libstdc++ or libgcc_s
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nodefaultlibs")
set(STATIC_BASE_LIBRARIES "-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic")
+ if(ENABLE_ASAN AND NOT WIN32 AND NOT APPLE)
+ set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -Wl,-Bstatic -lasan -Wl,-Bdynamic -ldl -lm -lpthread")
+ endif()
if(WIN32)
set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt")
set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -luser32 -lkernel32 -ladvapi32 -lshell32")