Skip to content

Commit 197aa24

Browse files
committed
Merge bitcoin/bitcoin#30856: build: drop obj/ subdirectory for generated build.h
7025942 build: drop superfluous `HAVE_BUILD_INFO` define (Sebastian Falbesoner) 0dd6625 build: drop obj/ subdir for generated build.h, rename to bitcoin-build-info.h (Sebastian Falbesoner) Pull request description: As indicated by the TODO, the obj subdirectory is not needed anymore now for the generated build.h header, since autotools are gone and we don't have in-source builds anymore (see #30454, #30664). In the second commit the superflous `HAVE_BUILD_INFO` macro is dropped, as suggested in bitcoin/bitcoin#30856 (review). ACKs for top commit: theuni: utACK 7025942 Tree-SHA512: 0a3b2cbbcf638344ceb74e5ba5a0fe2b1718427b23a18c8890258db36ce7177006a146178ed88d9c5ae956a5426f3844e86c1f4cca7c40946359742bffda983b
2 parents 84cd647 + 7025942 commit 197aa24

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,15 @@ include(AddWindowsResources)
88
configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-config.h USE_SOURCE_PERMISSIONS @ONLY)
99
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
1010

11-
# TODO: After the transition from Autotools to CMake, the obj/ subdirectory
12-
# could be dropped as its only purpose was to separate a generated header
13-
# from source files.
1411
add_custom_target(generate_build_info
15-
BYPRODUCTS ${PROJECT_BINARY_DIR}/src/obj/build.h
16-
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/obj
17-
COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/obj/build.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake
18-
COMMENT "Generating obj/build.h"
12+
BYPRODUCTS ${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h
13+
COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake
14+
COMMENT "Generating bitcoin-build-info.h"
1915
VERBATIM
2016
)
2117
add_library(bitcoin_clientversion OBJECT EXCLUDE_FROM_ALL
2218
clientversion.cpp
2319
)
24-
target_compile_definitions(bitcoin_clientversion
25-
PRIVATE
26-
HAVE_BUILD_INFO
27-
)
2820
target_link_libraries(bitcoin_clientversion
2921
PRIVATE
3022
core_interface

src/clientversion.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ using util::Join;
2323
const std::string CLIENT_NAME("Satoshi");
2424

2525

26-
#ifdef HAVE_BUILD_INFO
27-
#include <obj/build.h>
28-
// The <obj/build.h>, which is generated by the build environment (cmake/script/GenerateBuildInfo.cmake),
26+
#include <bitcoin-build-info.h>
27+
// The <bitcoin-build-info.h>, which is generated by the build environment (cmake/script/GenerateBuildInfo.cmake),
2928
// could contain only one line of the following:
3029
// - "#define BUILD_GIT_TAG ...", if the top commit is tagged
3130
// - "#define BUILD_GIT_COMMIT ...", if the top commit is not tagged
3231
// - "// No build information available", if proper git information is not available
33-
#endif
3432

3533
//! git will put "#define GIT_COMMIT_ID ..." on the next line inside archives. $Format:%n#define GIT_COMMIT_ID "%H"$
3634

0 commit comments

Comments
 (0)