about summary refs log tree commit diff homepage
path: root/cmake/cxx_flags_override.cmake
blob: 0e3946fe1df3df4b1f69a6104df3a9498c23c95b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#===------------------------------------------------------------------------===#
#
#                     The KLEE Symbolic Virtual Machine
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
# This file overrides the default compiler flags for CMake's built-in
# configurations (CMAKE_BUILD_TYPE). Most compiler flags should not be set
# here.  The main purpose is to make sure ``-DNDEBUG`` is never set by default.
#
#===------------------------------------------------------------------------===#

if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
  # Taken from Modules/Compiler/GNU.cmake but -DNDEBUG is removed
  set(CMAKE_CXX_FLAGS_INIT "")
  set(CMAKE_CXX_FLAGS_DEBUG_INIT "-O0 -g")
  set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os")
  set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3")
  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
else()
  message(FATAL_ERROR "Overrides not set for compiler ${CMAKE_CXX_COMPILER_ID}")
endif()