include_directories(..)

set(LSAN_CFLAGS
  ${SANITIZER_COMMON_CFLAGS})

set(LSAN_SOURCES
  lsan_interceptors.cc
  lsan_allocator.cc
  lsan_thread.cc
  lsan.cc
  lsan_common.cc
  lsan_common_linux.cc)

set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})

set(LSAN_RUNTIME_LIBRARIES)
set(arch "x86_64")
add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch}
  SOURCES ${LSAN_SOURCES}
          $<TARGET_OBJECTS:RTInterception.${arch}>
          $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
          $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
  CFLAGS ${LSAN_CFLAGS})
list(APPEND LSAN_RUNTIME_LIBRARIES clang_rt.lsan-${arch})

add_subdirectory(tests)

include_directories(..)

set(LSAN_CFLAGS
  ${SANITIZER_COMMON_CFLAGS})

set(LSAN_SOURCES
  lsan_interceptors.cc
  lsan_allocator.cc
  lsan_thread.cc
  lsan.cc
  lsan_common.cc
  lsan_common_linux.cc)

set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})

set(LSAN_RUNTIME_LIBRARIES)

# FIXME: support LSan for other arches.
if(CAN_TARGET_x86_64)
  set(arch "x86_64")
  add_compiler_rt_static_runtime(clang_rt.lsan-${arch} ${arch}
    SOURCES ${LSAN_SOURCES}
            $<TARGET_OBJECTS:RTInterception.${arch}>
            $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
            $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
    CFLAGS ${LSAN_CFLAGS})
  list(APPEND LSAN_RUNTIME_LIBRARIES clang_rt.lsan-${arch})
endif()

add_subdirectory(tests)

Build LSan on x86_64 only if this target is supported
Build LSan on x86_64 only if this target is supported

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@182272 91177308-0d34-0410-b5e6-96231b3b80d8
