From f3994915e359cd3c38158fd01359ddcd4eb61e7b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 18 Aug 2022 13:13:02 +1000 Subject: [PATCH] optimisation: add RUNTIME_DEBUGGING option --- nc_optimisation.cmake | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/nc_optimisation.cmake b/nc_optimisation.cmake index 4b2e07b..b2b097c 100644 --- a/nc_optimisation.cmake +++ b/nc_optimisation.cmake @@ -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) add_definitions(-DENABLE_DEBUGGING) - add_definitions(-D_GLIBCXX_DEBUG) + + if (RUNTIME_DEBUGGING) + add_definitions(-D_GLIBCXX_DEBUG) + endif() # 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