tsan: deflake tests
[blocksruntime.git] / include / CMakeLists.txt
blobd8a73872ba445cef46ca148c2e91df0fa284011f
1 set(SANITIZER_HEADERS
2   sanitizer/asan_interface.h
3   sanitizer/common_interface_defs.h
4   sanitizer/dfsan_interface.h
5   sanitizer/linux_syscall_hooks.h
6   sanitizer/lsan_interface.h
7   sanitizer/msan_interface.h)
9 set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
11 if(MSVC_IDE OR XCODE)
12    set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
13 endif()
15 # Copy compiler-rt headers to the build tree.
16 set(out_files)
17 foreach( f ${SANITIZER_HEADERS} )
18   set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
19   set( dst ${output_dir}/${f} )
20   add_custom_command(OUTPUT ${dst}
21     DEPENDS ${src}
22     COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
23     COMMENT "Copying compiler-rt's ${f}...")
24   list(APPEND out_files ${dst})
26   if(other_output_dir)
27    set(other_dst ${other_output_dir}/${f})
28     add_custom_command(OUTPUT ${other_dst}
29       DEPENDS ${src}
30       COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
31       COMMENT "Copying compiler-rt's ${f}...")    
32     list(APPEND out_files ${other_dst})
33   endif()
34 endforeach( f )
36 add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
37 add_dependencies(compiler-rt compiler-rt-headers)
39 # Install sanitizer headers.
40 install(FILES ${SANITIZER_HEADERS}
41   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
42   DESTINATION ${LIBCLANG_INSTALL_PATH}/include/sanitizer)