diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2017-07-15 00:30:46 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2017-07-15 00:30:46 +0000 |
commit | e6b35153993505d9192614d1403b67893868c178 (patch) | |
tree | 16af34d32dc472b15a6123ba061f1afbe26f7170 | |
parent | dd3d6da1dfc6833e39650a23b570a81b1e85aff8 (diff) | |
download | compiler-rt-e6b35153993505d9192614d1403b67893868c178.tar.gz |
[compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so
Differential Revision: https://reviews.llvm.org/D35400
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308072 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3195de1e5..f997c5341 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,10 +172,16 @@ endif() append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS) -# Build with optimization, unless we're in debug mode. If we're using MSVC, +# If we're using MSVC, # always respect the optimization flags set by CMAKE_BUILD_TYPE instead. -if(NOT COMPILER_RT_DEBUG AND NOT MSVC) - list(APPEND SANITIZER_COMMON_CFLAGS -O3) +if (NOT MSVC) + + # Build with optimization, unless we're in debug mode. + if(COMPILER_RT_DEBUG) + list(APPEND SANITIZER_COMMON_CFLAGS -O0) + else() + list(APPEND SANITIZER_COMMON_CFLAGS -O3) + endif() endif() # Determine if we should restrict stack frame sizes. |