blob: 3b39dfa9e098db3eb82187e519dc03586c43adf9 [file] [log] [blame]
Alexey Samsonov2a529ad2013-04-11 15:49:52 +00001set(SANITIZER_HEADERS
2 sanitizer/asan_interface.h
3 sanitizer/common_interface_defs.h
4 sanitizer/linux_syscall_hooks.h
Alexey Samsonov441a2162013-06-14 11:45:36 +00005 sanitizer/lsan_interface.h
Alexey Samsonov2a529ad2013-04-11 15:49:52 +00006 sanitizer/msan_interface.h)
7
8set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
9
10if(MSVC_IDE OR XCODE)
11 set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
12endif()
13
14# Copy compiler-rt headers to the build tree.
15set(out_files)
16foreach( 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()
33endforeach( f )
34
35add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
36
37# Install sanitizer headers.
38install(FILES ${SANITIZER_HEADERS}
39 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
40 DESTINATION ${LIBCLANG_INSTALL_PATH}/include/sanitizer)