Skip to content

Commit

Permalink
Merge #51: cmake: Generate obj/build.h header
Browse files Browse the repository at this point in the history
5c2c0f3 cmake: Generate `obj/build.h` header (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  theuni:
    ACK 5c2c0f3

Tree-SHA512: 78bb55034c1df587e68485a3137228b37fc79ace293516b386e3e7ff0796e804a680b455cff80cb71bb6af3d1d86e5d82286b20a4662cd72d8e1396417fc21cb
  • Loading branch information
hebasto committed Nov 16, 2023
2 parents 4291baa + 5c2c0f3 commit 0fdf4f1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ configure_file(${CMAKE_SOURCE_DIR}/cmake/bitcoin-config.h.in config/bitcoin-conf
add_compile_definitions(HAVE_CONFIG_H)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

# After the transition from Autotools to CMake, the obj/ subdirectory
# could be dropped as its only purpose was to separate a generated header
# from source files.
add_custom_target(generate_build_info
BYPRODUCTS ${PROJECT_BINARY_DIR}/src/obj/build.h
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/obj
COMMAND ${PROJECT_SOURCE_DIR}/share/genbuild.sh ${PROJECT_BINARY_DIR}/src/obj/build.h ${PROJECT_SOURCE_DIR}
COMMENT "Generating obj/build.h"
VERBATIM
)
add_library(bitcoin_clientversion OBJECT EXCLUDE_FROM_ALL
clientversion.cpp
)
target_compile_definitions(bitcoin_clientversion
PRIVATE
HAVE_BUILD_INFO
)
add_dependencies(bitcoin_clientversion generate_build_info)

add_subdirectory(crypto)
add_subdirectory(univalue)
add_subdirectory(util)
Expand Down
2 changes: 1 addition & 1 deletion src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL
time.cpp
tokenpipe.cpp
../chainparamsbase.cpp
../clientversion.cpp
../logging.cpp
../random.cpp
../randomenv.cpp
Expand All @@ -52,6 +51,7 @@ target_compile_definitions(bitcoin_util
target_link_libraries(bitcoin_util
PRIVATE
core
bitcoin_clientversion
bitcoin_crypto
Threads::Threads
$<$<BOOL:${MINGW}>:ws2_32>
Expand Down

0 comments on commit 0fdf4f1

Please sign in to comment.