1 # Copyright (c) 2025-present The Bitcoin Core developers
2 # Distributed under the MIT software license, see the accompanying
3 # file COPYING or https://opensource.org/license/mit/.
4 5 function(add_libmultiprocess subdir)
6 # Set BUILD_TESTING to match BUILD_TESTS. BUILD_TESTING is a standard cmake
7 # option that controls whether enable_testing() is called, but in the bitcoin
8 # build a BUILD_TESTS option is used instead.
9 set(BUILD_TESTING "${BUILD_TESTS}")
10 add_subdirectory(${subdir} EXCLUDE_FROM_ALL)
11 # Apply core_interface compile options to libmultiprocess runtime library.
12 target_link_libraries(multiprocess PUBLIC $<BUILD_INTERFACE:core_interface>)
13 target_link_libraries(mputil PUBLIC $<BUILD_INTERFACE:core_interface>)
14 target_link_libraries(mpgen PUBLIC $<BUILD_INTERFACE:core_interface>)
15 # Mark capproto options as advanced to hide by default from cmake UI
16 mark_as_advanced(CapnProto_DIR)
17 mark_as_advanced(CapnProto_capnpc_IMPORTED_LOCATION)
18 mark_as_advanced(CapnProto_capnp_IMPORTED_LOCATION)
19 mark_as_advanced(CapnProto_capnp-json_IMPORTED_LOCATION)
20 mark_as_advanced(CapnProto_capnp-rpc_IMPORTED_LOCATION)
21 mark_as_advanced(CapnProto_capnp-websocket_IMPORTED_LOCATION)
22 mark_as_advanced(CapnProto_kj-async_IMPORTED_LOCATION)
23 mark_as_advanced(CapnProto_kj-gzip_IMPORTED_LOCATION)
24 mark_as_advanced(CapnProto_kj-http_IMPORTED_LOCATION)
25 mark_as_advanced(CapnProto_kj_IMPORTED_LOCATION)
26 mark_as_advanced(CapnProto_kj-test_IMPORTED_LOCATION)
27 mark_as_advanced(CapnProto_kj-tls_IMPORTED_LOCATION)
28 if(BUILD_TESTS)
29 # Add tests to "all" target so ctest can run them
30 set_target_properties(mptest PROPERTIES EXCLUDE_FROM_ALL OFF)
31 endif()
32 # Exclude examples from compilation database, because the examples are not
33 # built by default, and they contain generated c++ code. Without this
34 # exclusion, tools like clang-tidy and IWYU that make use of compilation
35 # database would complain that the generated c++ source files do not exist. An
36 # alternate fix could build "mpexamples" by default like "mptests" above.
37 set_target_properties(mpcalculator mpprinter mpexample PROPERTIES EXPORT_COMPILE_COMMANDS OFF)
38 endfunction()
39