From e6b35153993505d9192614d1403b67893868c178 Mon Sep 17 00:00:00 2001 From: George Karpenkov Date: Sat, 15 Jul 2017 00:30:46 +0000 Subject: [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 --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') 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. -- cgit v1.2.3