[runtimes] When COMPILER_RT is enabled, consider SANITIZER prefixes
authorPetr Hosek <phosek@google.com>
Fri, 6 Mar 2020 22:38:07 +0000 (14:38 -0800)
committerPetr Hosek <phosek@google.com>
Wed, 11 Mar 2020 21:22:20 +0000 (14:22 -0700)
Currently we passthrough CMake variables based on project prefix,
i.e. LIBCXX_, LIBCXXABI_, LIBUNWIND_ and COMPILER_RT_. However, many
compiler-rt flags start with SANITIZER_ rather than COMPILER_RT, so
passthrough those as well.

Differential Revision: https://reviews.llvm.org/D75773

llvm/runtimes/CMakeLists.txt

index 64b5a57..94dabb8 100644 (file)
@@ -333,6 +333,11 @@ else() # if this is included from LLVM's CMake
     string(REPLACE "-" "_" canon_name ${projName})
     string(TOUPPER ${canon_name} canon_name)
     list(APPEND prefixes ${canon_name})
+    # Many compiler-rt options start with SANITIZER_ rather than COMPILER_RT_,
+    # so when compiler-rt is enabled, consider both.
+    if(canon_name STREQUAL "COMPILER_RT")
+      list(APPEND prefixes SANITIZER)
+    endif()
 
     string(FIND ${projName} "lib" LIB_IDX)
     if(LIB_IDX EQUAL 0)