diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-09-11 10:26:54 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-09-11 10:26:54 +0000 |
commit | 70a7095e37289746fd20595457d517faf66dc6a4 (patch) | |
tree | bdf01e63dc72658673899d78bd2c06185cfc5bdf /CMakeLists.txt | |
parent | 374520df0a4fde014380298d00bad4064de3e476 (diff) | |
download | compiler-rt-70a7095e37289746fd20595457d517faf66dc6a4.tar.gz compiler-rt-70a7095e37289746fd20595457d517faf66dc6a4.tar.bz2 compiler-rt-70a7095e37289746fd20595457d517faf66dc6a4.tar.xz |
[compiler-rt] Install support for CMake build of compiler-rt
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 08203600..845947c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,40 @@ function(set_target_compile_flags target) set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}") endfunction() +# Compute the Clang version from the LLVM version. +# FIXME: We should be able to reuse CLANG_VERSION variable calculated +# in Clang cmake files, instead of copying the rules here. +string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + ${PACKAGE_VERSION}) +# Setup the paths where compiler-rt runtimes and headers should be stored. +set(LIBCLANG_INSTALL_PATH lib${LLVM_LIBIR_SUFFIX}/clang/${CLANG_VERSION}) +string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR) + +# Install compiler-rt headers. +install(DIRECTORY include/ + DESTINATION ${LIBCLANG_INSTALL_PATH}/include + FILES_MATCHING + PATTERN "*.h" + PATTERN ".svn" EXCLUDE + ) + +# Call add_clang_compiler_rt_libraries to make sure that targets are built +# and installed in the directories where Clang driver expects to find them. +macro(add_clang_compiler_rt_libraries) + # Setup output directories so that clang in build tree works. + set_target_properties(${ARGN} PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY + ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR} + LIBRARY_OUTPUT_DIRECTORY + ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR} + ) + # Add installation command. + install(TARGETS ${ARGN} + ARCHIVE DESTINATION ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR} + LIBRARY DESTINATION ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR} + ) +endmacro(add_clang_compiler_rt_libraries) + # Add the public header's directory to the includes for all of compiler-rt. include_directories(include) |