cmake: Build `bitcoin-cli` executable

pull/30454/head
Hennadii Stepanov 6 months ago
parent a9813df826
commit b27bf9700d
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -66,6 +66,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
#============================= #=============================
# When adding a new option, end the <help_text> with a full stop for consistency. # When adding a new option, end the <help_text> with a full stop for consistency.
option(BUILD_DAEMON "Build bitcoind executable." ON) option(BUILD_DAEMON "Build bitcoind executable." ON)
option(BUILD_CLI "Build bitcoin-cli executable." ON)
option(WITH_CCACHE "Attempt to use ccache for compiling." ON) option(WITH_CCACHE "Attempt to use ccache for compiling." ON)
@ -193,7 +194,7 @@ target_link_libraries(core_interface INTERFACE
include(AddBoostIfNeeded) include(AddBoostIfNeeded)
add_boost_if_needed() add_boost_if_needed()
if(BUILD_DAEMON) if(BUILD_DAEMON OR BUILD_CLI)
find_package(Libevent 2.1.8 MODULE REQUIRED) find_package(Libevent 2.1.8 MODULE REQUIRED)
endif() endif()
@ -228,6 +229,7 @@ message("Configure summary")
message("=================") message("=================")
message("Executables:") message("Executables:")
message(" bitcoind ............................ ${BUILD_DAEMON}") message(" bitcoind ............................ ${BUILD_DAEMON}")
message(" bitcoin-cli ......................... ${BUILD_CLI}")
message("") message("")
message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}") message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}")
include(FlagsSummary) include(FlagsSummary)

@ -262,3 +262,27 @@ if(BUILD_DAEMON)
bitcoin_node bitcoin_node
) )
endif() endif()
add_library(bitcoin_cli STATIC EXCLUDE_FROM_ALL
compat/stdin.cpp
rpc/client.cpp
)
target_link_libraries(bitcoin_cli
PUBLIC
core_interface
univalue
)
# Bitcoin Core RPC client
if(BUILD_CLI)
add_executable(bitcoin-cli bitcoin-cli.cpp)
target_link_libraries(bitcoin-cli
core_interface
bitcoin_cli
bitcoin_common
bitcoin_util
$<TARGET_NAME_IF_EXISTS:libevent::libevent>
)
endif()

Loading…
Cancel
Save