aboutsummaryrefslogtreecommitdiff
path: root/lib/tsan/tests/CMakeLists.txt
blob: 0fcc6b2b1c8f3155a991890d931edf57cefae27b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
include_directories(../rtl)

add_custom_target(TsanUnitTests)
set_target_properties(TsanUnitTests PROPERTIES
  FOLDER "TSan unittests")
function(add_tsan_unittest testname)
  # Build unit tests only on 64-bit Linux.
  if(UNIX AND NOT APPLE
      AND CAN_TARGET_x86_64
      AND CMAKE_SIZEOF_VOID_P EQUAL 8
      AND NOT LLVM_BUILD_32_BITS)
    add_unittest(TsanUnitTests ${testname} ${ARGN})
    # Link with TSan runtime.
    target_link_libraries(${testname} clang_rt.tsan-x86_64)
    # Build tests with PIE and debug info.
    set_property(TARGET ${testname} APPEND_STRING
      PROPERTY COMPILE_FLAGS " -fPIE -g")
    set_property(TARGET ${testname} APPEND_STRING
      PROPERTY LINK_FLAGS " -pie")
  endif()
endfunction()

add_subdirectory(rtl)
add_subdirectory(unit)