1 include_directories(../rtl) 2 3 add_custom_target(TsanUnitTests) 4 set_target_properties(TsanUnitTests PROPERTIES 5 FOLDER "TSan unittests") 6 function(add_tsan_unittest testname) 7 # Build unit tests only on 64-bit Linux. 8 if(UNIX AND NOT APPLE 9 AND CAN_TARGET_x86_64 10 AND CMAKE_SIZEOF_VOID_P EQUAL 8 11 AND NOT LLVM_BUILD_32_BITS) 12 add_unittest(TsanUnitTests ${testname} ${ARGN}) 13 # Link with TSan runtime. 14 target_link_libraries(${testname} clang_rt.tsan-x86_64) 15 # Compile tests with the same flags as TSan runtime. 16 set_target_compile_flags(${testname} ${TSAN_CFLAGS}) 17 # Link tests with -pie. 18 set_property(TARGET ${testname} APPEND_STRING 19 PROPERTY LINK_FLAGS " -pie") 20 endif() 21 endfunction() 22 23 add_subdirectory(rtl) 24 add_subdirectory(unit) 25