Skip to content

Commit

Permalink
build: Make bitcoin_ipc_test depend on bitcoin_ipc
Browse files Browse the repository at this point in the history
This change is needed to allow generated capnp code in src/ipc/capnp/ to be
used in unit tests for better test coverage in upcoming commits.
  • Loading branch information
ryanofsky committed Sep 23, 2024
1 parent 070e6a3 commit 206c6e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,22 @@ if(WITH_MULTIPROCESS)
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
list(APPEND installable_targets bitcoin-node)

if(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
# compiler only allows importing by relative path when the importing and
# imported files are underneath the same compilation source prefix, so the
# source prefix must be src/, not src/test/
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
test/ipc_test.cpp
)
target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
test/ipc_test.capnp
)
add_dependencies(bitcoin_ipc_test bitcoin_ipc_headers)
endif()
endif()


Expand Down
8 changes: 0 additions & 8 deletions src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,6 @@ if(ENABLE_WALLET)
endif()

if(WITH_MULTIPROCESS)
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
ipc_test.cpp
)

target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
ipc_test.capnp
)

target_link_libraries(bitcoin_ipc_test
PRIVATE
core_interface
Expand Down

0 comments on commit 206c6e7

Please sign in to comment.