Skip to content

Commit 206c6e7

Browse files
committed
build: Make bitcoin_ipc_test depend on bitcoin_ipc
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.
1 parent 070e6a3 commit 206c6e7

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,22 @@ if(WITH_MULTIPROCESS)
325325
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
326326
)
327327
list(APPEND installable_targets bitcoin-node)
328+
329+
if(BUILD_TESTS)
330+
# bitcoin_ipc_test library target is defined here in src/CMakeLists.txt
331+
# instead of src/test/CMakeLists.txt so capnp files in src/test/ are able to
332+
# reference capnp files in src/ipc/capnp/ by relative path. The Cap'n Proto
333+
# compiler only allows importing by relative path when the importing and
334+
# imported files are underneath the same compilation source prefix, so the
335+
# source prefix must be src/, not src/test/
336+
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
337+
test/ipc_test.cpp
338+
)
339+
target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
340+
test/ipc_test.capnp
341+
)
342+
add_dependencies(bitcoin_ipc_test bitcoin_ipc_headers)
343+
endif()
328344
endif()
329345

330346

src/test/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,6 @@ if(ENABLE_WALLET)
160160
endif()
161161

162162
if(WITH_MULTIPROCESS)
163-
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
164-
ipc_test.cpp
165-
)
166-
167-
target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
168-
ipc_test.capnp
169-
)
170-
171163
target_link_libraries(bitcoin_ipc_test
172164
PRIVATE
173165
core_interface

0 commit comments

Comments
 (0)