Skip to content

Commit

Permalink
build: create an EXTRA_DEBUG build option
Browse files Browse the repository at this point in the history
This unties the debug defines from the Debug build config
  • Loading branch information
theuni committed Jan 14, 2025
1 parent dc41d78 commit 9485975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
$<$<CONFIG:Debug>:core_interface_debug>
core_interface_debug
$<$<CONFIG:Depends>:core_interface_depends>
)

Expand Down
8 changes: 0 additions & 8 deletions cmake/module/ProcessConfigurations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9485975

Please sign in to comment.