Skip to content

Commit

Permalink
cmake: Build bitcoin-cli executable
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed May 1, 2023
1 parent 5fc2cee commit 1934755
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,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.
include(CMakeDependentOption)
option(BUILD_DAEMON "Build bitcoind executable." ON)
option(BUILD_CLI "Build bitcoin-cli executable." ON)
option(ASM "Use assembly routines." ON)
cmake_dependent_option(CXX20 "Enable compilation in C++20 mode." OFF "NOT MSVC" ON)
option(THREADLOCAL "Enable features that depend on the C++ thread_local keyword (currently just thread names in debug logs)." ON)
Expand Down Expand Up @@ -148,6 +149,7 @@ message("Configure summary")
message("=================")
message("Executables:")
message(" bitcoind ............................ ${BUILD_DAEMON}")
message(" bitcoin-cli ......................... ${BUILD_CLI}")
message("Optional packages:")
message(" NAT-PMP ............................. ${WITH_NATPMP}")
message(" UPnP ................................ ${WITH_MINIUPNPC}")
Expand Down
22 changes: 22 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,25 @@ if(BUILD_DAEMON)
$<$<BOOL:${MINGW}>:-static>
)
endif()


add_library(bitcoin_cli STATIC EXCLUDE_FROM_ALL
compat/stdin.cpp
rpc/client.cpp
)
target_link_libraries(bitcoin_cli
PUBLIC
univalue
)


# Bitcoin Core RPC client
if(BUILD_CLI)
add_executable(bitcoin-cli bitcoin-cli.cpp)
target_link_libraries(bitcoin-cli
bitcoin_cli
bitcoin_common
bitcoin_util
libevent::libevent
)
endif()

0 comments on commit 1934755

Please sign in to comment.