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