From 94859754e737b66ae5f49d6151b0e2e110d911e3 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 14 Jan 2025 19:53:57 +0000 Subject: [PATCH] build: create an EXTRA_DEBUG build option This unties the debug defines from the Debug build config --- CMakeLists.txt | 15 ++++++++++++++- cmake/module/ProcessConfigurations.cmake | 8 -------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b344299bfc8ac..322577444b796 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,7 @@ endif() option(BUILD_BENCH "Build bench_bitcoin executable." OFF) option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF) option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF) +option(EXTRA_DEBUG "Enable extra debug options" OFF) option(INSTALL_MAN "Install man pages." ON) @@ -203,8 +204,20 @@ unset(check_pie_output) add_library(core_interface INTERFACE) add_library(core_interface_depends INTERFACE) add_library(core_interface_debug INTERFACE) + +# Redefine/adjust per-configuration flags. +if(EXTRA_DEBUG) + target_compile_definitions(core_interface_debug INTERFACE + DEBUG + DEBUG_LOCKORDER + DEBUG_LOCKCONTENTION + RPC_DOC_CHECK + ABORT_ON_FAILED_ASSUME + ) +endif() + target_link_libraries(core_interface INTERFACE - $<$:core_interface_debug> + core_interface_debug $<$:core_interface_depends> ) diff --git a/cmake/module/ProcessConfigurations.cmake b/cmake/module/ProcessConfigurations.cmake index 7e2fc0080e98e..52fca3cd1f7c9 100644 --- a/cmake/module/ProcessConfigurations.cmake +++ b/cmake/module/ProcessConfigurations.cmake @@ -119,14 +119,6 @@ endfunction() set_default_config(RelWithDebInfo) -# Redefine/adjust per-configuration flags. -target_compile_definitions(core_interface_debug INTERFACE - DEBUG - DEBUG_LOCKORDER - DEBUG_LOCKCONTENTION - RPC_DOC_CHECK - ABORT_ON_FAILED_ASSUME -) # We leave assertions on. if(MSVC) remove_cxx_flag_from_all_configs(/DNDEBUG)