optimisation: add RUNTIME_DEBUGGING option

This commit is contained in:
Danny Robson 2022-08-18 13:13:02 +10:00
parent aa7b95facb
commit f3994915e3

View File

@ -157,9 +157,33 @@ endif ()
############################################################################### ###############################################################################
if (CMAKE_BUILD_TYPE MATCHES Debug)
set (_DEFAULT_RUNTIME_DEBUGGING ON)
else()
set (_DEFAULT_RUNTIME_DEBUGGING OFF)
endif()
#message(FATAL_ERROR "RUNTIME DEBUGGING ${_DEFAULT_RUNTIME_DEBUGGING}")
option(
RUNTIME_DEBUGGING
"enable debugging features that impact runtime and ABI"
${_DEFAULT_RUNTIME_DEBUGGING}
)
if (RUNTIME_DEBUGGING)
if (CMAKE_BUILD_TYPE MATCHES Debug)
else()
message(FATAL_ERROR "RUNTIME_DEBUGGING is only supported under a DEBUG build")
endif()
endif ()
if (CMAKE_BUILD_TYPE MATCHES Debug) if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DENABLE_DEBUGGING) add_definitions(-DENABLE_DEBUGGING)
if (RUNTIME_DEBUGGING)
add_definitions(-D_GLIBCXX_DEBUG) add_definitions(-D_GLIBCXX_DEBUG)
endif()
# Don't make any commits that use -O0 by default. Instead, either add an # Don't make any commits that use -O0 by default. Instead, either add an
# argument that allows one to choose, or temporarily switch the lines # argument that allows one to choose, or temporarily switch the lines