]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: pass Sanitizers flags to linker for linking .so
authorKefu Chai <kchai@redhat.com>
Mon, 22 Oct 2018 04:42:10 +0000 (12:42 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 22 Oct 2018 06:40:03 +0000 (14:40 +0800)
see
https://github.com/google/sanitizers/wiki/AddressSanitizer#using-addresssanitizer

to be specific,

> In order to use AddressSanitizer you will need to compile and link your
> program using `clang` with the `-fsanitize=address` switch.

Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt

index 1708ad173c35dcb390a395e9864aef9ed5f29dd2..abf6d16a81e70ed5da1b86402e6d9bced33676ef 100644 (file)
@@ -598,6 +598,7 @@ if(sanitizers)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Sanitizers_COMPILE_OPTIONS}")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Sanitizers_COMPILE_OPTIONS}")
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${Sanitizers_COMPILE_OPTIONS}")
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${Sanitizers_COMPILE_OPTIONS}")
 endif()
 
 # Rocksdb