summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-01-20 13:58:10 +0000
committerAlexey Samsonov <samsonov@google.com>2013-01-20 13:58:10 +0000
commite16af95daecd44b32940fe910fac2deee3220ac1 (patch)
tree57edda6fd040d9905276f12a212fb9eb9f1e4031 /CMakeLists.txt
parent250929e797085ddd4ba54fe9872dc25c1647d0a4 (diff)
downloadcompiler-rt-e16af95daecd44b32940fe910fac2deee3220ac1.tar.gz
compiler-rt-e16af95daecd44b32940fe910fac2deee3220ac1.tar.bz2
compiler-rt-e16af95daecd44b32940fe910fac2deee3220ac1.tar.xz
CMake: Add add_compiler_rt_static_runtime function and use it to build generic compiler-rt libraries
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@172977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 17 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04d6e976..4239c419 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,19 @@ include(LLVMParseArguments)
# runtime libraries.
cmake_minimum_required(VERSION 2.8.8)
+# 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_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
+string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR)
+set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/lib/${LIBCLANG_OS_DIR})
+set(COMPILER_RT_LIBRARY_INSTALL_DIR
+ ${LIBCLANG_INSTALL_PATH}/lib/${LIBCLANG_OS_DIR})
+
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
@@ -129,15 +142,6 @@ endif()
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
x86_64 i386)
-# 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_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
-string(TOLOWER ${CMAKE_SYSTEM_NAME} LIBCLANG_OS_DIR)
-
# Install compiler-rt headers.
install(DIRECTORY include/
DESTINATION ${LIBCLANG_INSTALL_PATH}/include
@@ -151,16 +155,12 @@ install(DIRECTORY include/
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}
- )
+ ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+ LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_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}
- )
+ ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
+ LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
endmacro(add_clang_compiler_rt_libraries)
# Add the public header's directory to the includes for all of compiler-rt.