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