summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-03-01 22:30:17 +0000
committerMartin Storsjo <martin@martin.st>2019-03-01 22:30:17 +0000
commitaf14bad77d21bdbe48d9ba7eabb0d9edfb812eab (patch)
tree646c41673ea792fa148ef582550eeaccac6b994d /CMakeLists.txt
parent66ff02b5c1a345c1b76de1d4297d7585577bb0a5 (diff)
downloadcompiler-rt-af14bad77d21bdbe48d9ba7eabb0d9edfb812eab.tar.gz
[CMake] Don't use llvm_replace_compiler_option
Building compiler-rt standalone outside of the main llvm tree is supported, and in this case, the llvm cmake modules are unavailable. (And even if they are available, it requires including LLVMProcessSources.cmake, which currently isn't included.) This fixes building compiler-rt standalone with MSVC/clang-cl. Differential Revision: https://reviews.llvm.org/D58767 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c530f5f0..612f4e1fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -375,9 +375,13 @@ if(MSVC)
# warning from the MS linker complaining that it can't find the 'vc140.pdb'
# file used by our object library compilations.
list(APPEND SANITIZER_COMMON_CFLAGS /Z7)
- llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/Z[i7I]" "/Z7")
- llvm_replace_compiler_option(CMAKE_CXX_FLAGS_DEBUG "/Z[i7I]" "/Z7")
- llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z[i7I]" "/Z7")
+ foreach(var_to_update
+ CMAKE_CXX_FLAGS
+ CMAKE_CXX_FLAGS_DEBUG
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ string(REGEX REPLACE "(^| )/Z[i7I]($| )" " /Z7 "
+ "${var_to_update}" "${${var_to_update}}")
+ endforeach()
elseif(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG AND NOT COMPILER_RT_DEBUG)
list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
elseif(COMPILER_RT_HAS_G_FLAG)