Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show All 34 Lines | if(ECM_MODULE_PATH) | ||||
include(ECMEnableSanitizers) | include(ECMEnableSanitizers) | ||||
else() | else() | ||||
message(FATAL_ERROR | message(FATAL_ERROR | ||||
"ECM is required to enable the sanitizers (https://api.kde.org/ecm/index.html)" | "ECM is required to enable the sanitizers (https://api.kde.org/ecm/index.html)" | ||||
) | ) | ||||
endif() | endif() | ||||
endif() | endif() | ||||
# Cmake uses the CMAKE_BUILD_TYPE variable to select the build configuration. | |||||
# By default it supports more configurations that needed for Bitcoin ABC, and | |||||
# all the releases types set NDEBUG which is unwanted as it disables the assert | |||||
# completely. | |||||
# Remove the -DNDEBUG flag from the CFLAGS/CXXFLAGS in all the configurations | |||||
include(AddCompilerFlags) | include(AddCompilerFlags) | ||||
remove_compiler_flags(-DNDEBUG) | |||||
# Overrides the flags for the Debug build type | |||||
# This mimics the autotools behavior by setting the CFLAGS to '-g -O2`, which | |||||
# are not well suited for debugging. | |||||
# FIXME: update CFLAGS with better debug oriented optimization flags | |||||
set(CMAKE_C_FLAGS_DEBUG "-g -O2") | |||||
# Disable all optimizations | |||||
set(CMAKE_CXX_FLAGS_DEBUG -O0) | |||||
# Prefer -g3, defaults to -g if unavailable | # Prefer -g3, defaults to -g if unavailable | ||||
add_cxx_compiler_flag_with_fallback(CMAKE_CXX_FLAGS_DEBUG -g3 -g) | add_cxx_compiler_flag_with_fallback(CMAKE_CXX_FLAGS_DEBUG -g3 -g) | ||||
# Define the debugging symbols DEBUG and DEBUG_LOCKORDER when the Debug build | # Define the debugging symbols DEBUG and DEBUG_LOCKORDER when the Debug build | ||||
# type is selected. | # type is selected. | ||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DDEBUG -DDEBUG_LOCKORDER") | string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DDEBUG -DDEBUG_LOCKORDER") | ||||
# Add -ftrapv when building in Debug | # Add -ftrapv when building in Debug | ||||
▲ Show 20 Lines • Show All 492 Lines • Show Last 20 Lines |