1 include_directories(..) 2 3 set(LSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) 4 append_no_rtti_flag(LSAN_CFLAGS) 5 6 set(LSAN_COMMON_SOURCES 7 lsan_common.cc 8 lsan_common_linux.cc) 9 10 set(LSAN_SOURCES 11 lsan.cc 12 lsan_allocator.cc 13 lsan_interceptors.cc 14 lsan_preinit.cc 15 lsan_thread.cc) 16 17 set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 18 19 add_custom_target(lsan) 20 21 add_compiler_rt_object_libraries(RTLSanCommon 22 OS ${SANITIZER_COMMON_SUPPORTED_OS} 23 ARCHS ${LSAN_COMMON_SUPPORTED_ARCH} 24 SOURCES ${LSAN_COMMON_SOURCES} 25 CFLAGS ${LSAN_CFLAGS}) 26 27 if(COMPILER_RT_HAS_LSAN) 28 foreach(arch ${LSAN_SUPPORTED_ARCH}) 29 add_compiler_rt_runtime(clang_rt.lsan 30 STATIC 31 ARCHS ${arch} 32 SOURCES ${LSAN_SOURCES} 33 $<TARGET_OBJECTS:RTInterception.${arch}> 34 $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> 35 $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> 36 $<TARGET_OBJECTS:RTLSanCommon.${arch}> 37 CFLAGS ${LSAN_CFLAGS} 38 PARENT_TARGET lsan) 39 endforeach() 40 endif() 41 42 add_dependencies(compiler-rt lsan) 43