summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-01-29 11:46:06 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-01-29 11:46:06 +0000
commitbc2b5bada0204be28c362b6838b6a820bf5d578a (patch)
tree7276aa71edaeb842e506b7e05b812a011fa94507 /CMakeLists.txt
parent518908037a5438758ffc7e166176b3b28e8bef78 (diff)
downloadcompiler-rt-bc2b5bada0204be28c362b6838b6a820bf5d578a.tar.gz
compiler-rt-bc2b5bada0204be28c362b6838b6a820bf5d578a.tar.bz2
compiler-rt-bc2b5bada0204be28c362b6838b6a820bf5d578a.tar.xz
[sanitizer] Copy sanitizer headers to the build tree.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@173794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66f5859d..bd4295eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,6 +149,39 @@ endif()
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
x86_64 i386 powerpc64 powerpc)
+file(GLOB_RECURSE COMPILER_RT_HEADERS
+ RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/include"
+ "include/*.h")
+
+set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
+
+if(MSVC_IDE OR XCODE)
+ set(other_output_dir ${LLVM_BINARY_DIR}/bin/lib/clang/${CLANG_VERSION}/include)
+endif()
+
+# Copy compiler-rt headers to the build tree.
+set(out_files)
+foreach( f ${COMPILER_RT_HEADERS} )
+ set( src ${CMAKE_CURRENT_SOURCE_DIR}/include/${f} )
+ set( dst ${output_dir}/${f} )
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying compiler-rt's ${f}...")
+ list(APPEND out_files ${dst})
+
+ if(other_output_dir)
+ set(other_dst ${other_output_dir}/${f})
+ add_custom_command(OUTPUT ${other_dst}
+ DEPENDS ${src}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
+ COMMENT "Copying compiler-rt's ${f}...")
+ list(APPEND out_files ${other_dst})
+ endif()
+endforeach( f )
+
+add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
+
# Install compiler-rt headers.
install(DIRECTORY include/
DESTINATION ${LIBCLANG_INSTALL_PATH}/include