Merge bitcoin/bitcoin#31834: build: disable bitcoin-node if daemon is not built

2ffea09820 build: disable bitcoin-node if daemon is not built (Sjors Provoost)

Pull request description:

  When building for fuzzing with multiprocess enabled, we were still trying to build `bitcoin-node`. This PR fixes that, by applying a similar check as for `bitcoin-gui`.

  Before:

  ```
  cmake -B build -DBUILD_FOR_FUZZING=ON -DWITH_MULTIPROCESS=ON

  ...

  Configure summary
  =================
  Executables:
    bitcoind ............................ OFF
    bitcoin-node (multiprocess) ......... ON
    bitcoin-qt (GUI) .................... OFF
    bitcoin-gui (GUI, multiprocess) ..... OFF

  ...

  cmake --build build

  ...

  [ 84%] Built target bitcoin-node
  ```

  After:

  ```
    bitcoin-node (multiprocess) ......... OFF
  ```

  And no `bitcoin-node` target gets built (not to be confused with `bitcoin_node`).

ACKs for top commit:
  hebasto:
    ACK 2ffea09820.
  ryanofsky:
    Code review ACK 2ffea09820
  laanwj:
    Code review ACK 2ffea09820

Tree-SHA512: bdb0b62049f77929d5c084bf98a076e9933de91eb30853ed89edd23cc81b3d4aec4cd57c9a9e21cf1d6930885f8c408dda830db6884b4e326c7fb348f1fbab4c
This commit is contained in:
Ryan Ofsky 2025-02-11 07:47:36 -05:00
commit 86528937e5
No known key found for this signature in database
GPG key ID: 46800E30FC748A66
2 changed files with 9 additions and 4 deletions

View file

@ -609,7 +609,12 @@ message("Configure summary")
message("=================")
message("Executables:")
message(" bitcoind ............................ ${BUILD_DAEMON}")
message(" bitcoin-node (multiprocess) ......... ${WITH_MULTIPROCESS}")
if(BUILD_DAEMON AND WITH_MULTIPROCESS)
set(bitcoin_daemon_status ON)
else()
set(bitcoin_daemon_status OFF)
endif()
message(" bitcoin-node (multiprocess) ......... ${bitcoin_daemon_status}")
message(" bitcoin-qt (GUI) .................... ${BUILD_GUI}")
if(BUILD_GUI AND WITH_MULTIPROCESS)
set(bitcoin_gui_status ON)

View file

@ -320,7 +320,7 @@ if(BUILD_DAEMON)
)
list(APPEND installable_targets bitcoind)
endif()
if(WITH_MULTIPROCESS)
if(WITH_MULTIPROCESS AND BUILD_DAEMON)
add_executable(bitcoin-node
bitcoind.cpp
init/bitcoin-node.cpp
@ -332,8 +332,9 @@ if(WITH_MULTIPROCESS)
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
list(APPEND installable_targets bitcoin-node)
endif()
if(BUILD_TESTS)
if(WITH_MULTIPROCESS AND BUILD_TESTS)
# bitcoin_ipc_test library target is defined here in src/CMakeLists.txt
# instead of src/test/CMakeLists.txt so capnp files in src/test/ are able to
# reference capnp files in src/ipc/capnp/ by relative path. The Cap'n Proto
@ -347,7 +348,6 @@ if(WITH_MULTIPROCESS)
test/ipc_test.capnp
)
add_dependencies(bitcoin_ipc_test bitcoin_ipc_headers)
endif()
endif()