cmake: Support building with libmultiprocess subtree

When ENABLE_IPC option is on, build with libmultiprocess subtree and
`add_subdirectory(src/ipc/libmultiprocess)` instead of external package
and `find_package(Libmultiprocess)` by default.

Behavior can be toggled with `WITH_EXTERNAL_LIBMULTIPROCESS` option. Using a
subtree should be more convenient for most bitcoin developers, but using an
external package is more convenient for developing in the libmultiprocess
repository.

The `WITH_EXTERNAL_LIBMULTIPROCESS` option is also used to avoid needing to
changing the depends build here. But in later commits, the depends build is
switched to use the add_subdirectory build as well.

Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
This commit is contained in:
Ryan Ofsky
2025-01-26 13:12:23 -05:00
parent 69f0d4adb7
commit d597ab1dee
4 changed files with 46 additions and 1 deletions

View File

@@ -160,8 +160,10 @@ endif()
if("@multiprocess@" STREQUAL "1")
set(ENABLE_IPC ON CACHE BOOL "")
set(WITH_EXTERNAL_LIBMULTIPROCESS ON CACHE BOOL "")
set(Libmultiprocess_ROOT "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "")
set(LibmultiprocessNative_ROOT "${CMAKE_CURRENT_LIST_DIR}/native" CACHE PATH "")
else()
set(ENABLE_IPC OFF CACHE BOOL "")
set(WITH_EXTERNAL_LIBMULTIPROCESS OFF CACHE BOOL "")
endif()