summaryrefslogtreecommitdiff
path: root/runtimes/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-08-30 21:29:21 +0000
committerChris Bieneman <beanz@apple.com>2016-08-30 21:29:21 +0000
commit3449d54601c4f207af256905ab5336a838bbc29b (patch)
treedd42b4400d7de0ed3ec4ef4cf229fb066d66ed6d /runtimes/CMakeLists.txt
parentb8c2c1d3ff7ecab78f7a477bb52b88cf1379a5d2 (diff)
[CMake] Ensure that compiler-rt is added first
This will enable other runtime projects to detect the presence of sanitizer runtimes by referring to the sanitizer targets directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280162 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtimes/CMakeLists.txt')
-rw-r--r--runtimes/CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index a787fc9b5b7..0ffffd6fbfe 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -33,6 +33,21 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
"${LLVM_BINARY_DIR}/lib/cmake/llvm"
)
+ # Some of the runtimes will conditionally use the compiler-rt sanitizers
+ # to make this work smoothly we ensure that compiler-rt is added first in
+ # the list of sub-projects. This allows other sub-projects to have checks
+ # like `if(TARGET asan)` to enable building with asan.
+ foreach(entry ${runtimes})
+ if("${entry}" MATCHES "compiler-rt")
+ set(compiler_rt_path ${entry})
+ break()
+ endif()
+ endforeach()
+ if(compiler_rt_path)
+ list(REMOVE_ITEM runtimes ${compiler_rt_path})
+ list(INSERT runtimes 0 ${compiler_rt_path})
+ endif()
+
# LLVMConfig.cmake contains a bunch of CMake variables from the LLVM build.
# This file is installed as part of LLVM distributions, so this can be used
# either from a build directory or an installed LLVM.