aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-11-13 14:06:35 +0100
committerPierre Ossman <ossman@cendio.se>2015-11-27 11:11:22 +0100
commitb74728f9d653ece2d25f26aa563f7e5ecbdc4023 (patch)
tree98fede32546a3905f04c9b69cdea788a88d4305d /cmake
parentbf431a6b980f80d74463afbc60a3de3ce95dd5b5 (diff)
downloadtigervnc-b74728f9d653ece2d25f26aa563f7e5ecbdc4023.tar.gz
tigervnc-b74728f9d653ece2d25f26aa563f7e5ecbdc4023.zip
Add option to enable thread sanitizer
Diffstat (limited to 'cmake')
-rw-r--r--cmake/StaticBuild.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake
index 5a3d9987..6db0e14b 100644
--- a/cmake/StaticBuild.cmake
+++ b/cmake/StaticBuild.cmake
@@ -119,6 +119,13 @@ if(BUILD_STATIC_GCC)
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(ENABLE_TSAN AND NOT WIN32 AND NOT APPLE AND CMAKE_SIZEOF_VOID_P MATCHES 8)
+ # libtsan redefines some C++ symbols which then conflict with a
+ # statically linked libstdc++. Work around this by allowing multiple
+ # definitions. The linker will pick the first one (i.e. the one
+ # from libtsan).
+ set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -Wl,-z -Wl,muldefs -Wl,-Bstatic -ltsan -Wl,-Bdynamic -ldl -lm")
+ 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")