Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 15: [PATCH 15/17] fix(build): classify Homebrew IPC dependency headers as system

cmake/libmultiprocess.cmake

Before: cmake/libmultiprocess.cmake · After: cmake/libmultiprocess.cmake

File metadata
index 027109a90511bbbe5ff5feff94438468c1986ce7..e844f7f22300a356ab1bc8240fba087237af3877 100644

Download original patch · Release notes

Diff rows 1–41 of 41. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

cmake/libmultiprocess.cmake CHANGED
@@ -12,6 +12,41 @@ function(add_libmultiprocess subdir)
12
12
  target_link_libraries(multiprocess PUBLIC $<BUILD_INTERFACE:core_interface>)
13
13
  target_link_libraries(mputil PUBLIC $<BUILD_INTERFACE:core_interface>)
14
14
  target_link_libraries(mpgen PUBLIC $<BUILD_INTERFACE:core_interface>)
15
+ if(CMAKE_HOST_APPLE)
16
+ find_program(HOMEBREW_EXECUTABLE brew)
17
+ if(HOMEBREW_EXECUTABLE)
18
+ execute_process(
19
+ COMMAND ${HOMEBREW_EXECUTABLE} --prefix
20
+ OUTPUT_VARIABLE _homebrew_prefix
21
+ RESULT_VARIABLE _homebrew_status
22
+ ERROR_QUIET
23
+ OUTPUT_STRIP_TRAILING_WHITESPACE
24
+ )
25
+ # CapnProto's imported targets are scoped to the vendored subdirectory.
26
+ # Read its configured include path without changing that dependency.
27
+ get_directory_property(_capnp_include_dir DIRECTORY "${subdir}" DEFINITION CAPNP_INCLUDE_DIRECTORY)
28
+ if(_homebrew_status EQUAL 0 AND
29
+ IS_DIRECTORY "${_capnp_include_dir}/capnp" AND
30
+ IS_DIRECTORY "${_capnp_include_dir}/kj" AND
31
+ IS_DIRECTORY "${_homebrew_prefix}/include/capnp" AND
32
+ IS_DIRECTORY "${_homebrew_prefix}/include/kj")
33
+ file(REAL_PATH "${_capnp_include_dir}/capnp" _configured_capnp)
34
+ file(REAL_PATH "${_capnp_include_dir}/kj" _configured_kj)
35
+ file(REAL_PATH "${_homebrew_prefix}/include/capnp" _linked_capnp)
36
+ file(REAL_PATH "${_homebrew_prefix}/include/kj" _linked_kj)
37
+ if(_configured_capnp STREQUAL _linked_capnp AND _configured_kj STREQUAL _linked_kj)
38
+ # CMake drops implicit include paths from generated -isystem flags.
39
+ # Keep the matching Homebrew alias system for IPC and its consumers.
40
+ foreach(_target multiprocess mputil mpgen)
41
+ target_compile_options(${_target} PUBLIC
42
+ "$<$<COMPILE_LANGUAGE:CXX>:SHELL:-isystem \"${_homebrew_prefix}/include\">"
43
+ )
44
+ endforeach()
45
+ message(STATUS "Using matching Homebrew CapnProto header alias: ${_homebrew_prefix}/include")
46
+ endif()
47
+ endif()
48
+ endif()
49
+ endif()
15
50
  # Mark capproto options as advanced to hide by default from cmake UI
16
51
  mark_as_advanced(CapnProto_DIR)
17
52
  mark_as_advanced(CapnProto_capnpc_IMPORTED_LOCATION)