[compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so

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

llvm-svn: 308072
This commit is contained in:
George Karpenkov 2017-07-15 00:30:46 +00:00
parent 0bc7d63322
commit e89d0a8f5c
1 changed files with 9 additions and 3 deletions

View File

@ -172,10 +172,16 @@ endif()
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS) 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. # always respect the optimization flags set by CMAKE_BUILD_TYPE instead.
if(NOT COMPILER_RT_DEBUG AND NOT MSVC) if (NOT MSVC)
list(APPEND SANITIZER_COMMON_CFLAGS -O3)
# 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() endif()
# Determine if we should restrict stack frame sizes. # Determine if we should restrict stack frame sizes.