Skip to content

Commit 0b6ed34

Browse files
committed
Merge bitcoin/bitcoin#31711: build: set build type and per-build-type flags as early as possible
56a9b84 build: set build type and per-build-type flags as early as possible (Cory Fields) f605f7a build: refactor: set debug definitions in main CMakeLists (Cory Fields) Pull request description: This ensures that most compiler tests are not run with the wrong build type's flags. The initial c++ checks are an exception to that because many internal CMake variables are unset until a language is selected, so it's problematic to change our build type before that. The difference can be seen in `build/CMakeFiles/CMakeConfigureLog.yaml`. Before, `Debug` was used for many of the earlly checks. After this PR, it's only the first 2 checks. ACKs for top commit: hebasto: ACK 56a9b84. Tree-SHA512: 87947352d6d4fd08554515822cb13634ed3be33fcda2af817c22ef943b1d0856ceb39311ddc01b8221397528fdc09f630dc7e74fc92f5a4a073f09c4ae493596
2 parents a44cced + 56a9b84 commit 0b6ed34

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
7070
set(CMAKE_CXX_EXTENSIONS OFF)
7171

7272
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
73+
include(ProcessConfigurations)
7374

7475
#=============================
7576
# Configurable options
@@ -230,11 +231,18 @@ if(BUILD_FOR_FUZZING)
230231
)
231232
endif()
232233

233-
include(ProcessConfigurations)
234-
235234
include(TryAppendCXXFlags)
236235
include(TryAppendLinkerFlag)
237236

237+
# Redefine/adjust per-configuration flags.
238+
target_compile_definitions(core_interface_debug INTERFACE
239+
DEBUG
240+
DEBUG_LOCKORDER
241+
DEBUG_LOCKCONTENTION
242+
RPC_DOC_CHECK
243+
ABORT_ON_FAILED_ASSUME
244+
)
245+
238246
if(WIN32)
239247
#[=[
240248
This build system supports two ways to build binaries for Windows.

cmake/module/ProcessConfigurations.cmake

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
include_guard(GLOBAL)
66

7-
include(TryAppendCXXFlags)
8-
97
macro(normalize_string string)
108
string(REGEX REPLACE " +" " " ${string} "${${string}}")
119
string(STRIP "${${string}}" ${string})
@@ -119,14 +117,8 @@ endfunction()
119117

120118
set_default_config(RelWithDebInfo)
121119

122-
# Redefine/adjust per-configuration flags.
123-
target_compile_definitions(core_interface_debug INTERFACE
124-
DEBUG
125-
DEBUG_LOCKORDER
126-
DEBUG_LOCKCONTENTION
127-
RPC_DOC_CHECK
128-
ABORT_ON_FAILED_ASSUME
129-
)
120+
include(TryAppendCXXFlags)
121+
130122
# We leave assertions on.
131123
if(MSVC)
132124
remove_cxx_flag_from_all_configs(/DNDEBUG)

0 commit comments

Comments
 (0)