Skip to content

Commit 67ea4b9

Browse files
committed
Merge bitcoin/bitcoin#32814: cmake: Explicitly specify Boost_ROOT for Homebrew's package
8800b5a cmake: Explicitly specify `Boost_ROOT` for Homebrew's package (Hennadii Stepanov) Pull request description: On macOS, this PR ensures that the Boost package is located at its real path rather than via the symlink in the default prefix. A backport to 29.x is required for bitcoin/bitcoin#32804, as this change prevents contamination of include directories by broad locations such as `/usr/local/include` or `/opt/homebrew/include`, which take precedence over Qt’s `-iframework` flags. Below is the relevant change in the configuration logs on my macOS 15.5 `x64`: - master branch @ ead4468: ``` % cmake -B build <snip> -- Found Boost: /usr/local/include (found suitable version "1.88.0", minimum required is "1.73.0") <snip> ``` - this PR: ``` % cmake -B build <snip> -- Found Boost: /usr/local/opt/boost/include (found suitable version "1.88.0", minimum required is "1.73.0") <snip> ``` This PR is forward-compatible with the changes proposed in bitcoin/bitcoin#32667. ACKs for top commit: fanquake: ACK 8800b5a Checked that this plus #32805 fixes #31009 Tree-SHA512: 114bd945ec0c06a8d15b565e5b9aafc3bcfdf2a4ba4400e072b8e31053dff0f9ef423b941ee1dff2113f83e08f7fada728383ae88b3ec380b5c3e40553205f7d
2 parents 5170ec1 + 8800b5a commit 67ea4b9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmake/module/AddBoostIfNeeded.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ function(add_boost_if_needed)
1717
directory and other added INTERFACE properties.
1818
]=]
1919

20+
if(CMAKE_HOST_APPLE)
21+
find_program(HOMEBREW_EXECUTABLE brew)
22+
if(HOMEBREW_EXECUTABLE)
23+
execute_process(
24+
COMMAND ${HOMEBREW_EXECUTABLE} --prefix boost
25+
OUTPUT_VARIABLE Boost_ROOT
26+
ERROR_QUIET
27+
OUTPUT_STRIP_TRAILING_WHITESPACE
28+
)
29+
endif()
30+
endif()
31+
2032
# We cannot rely on find_package(Boost ...) to work properly without
2133
# Boost_NO_BOOST_CMAKE set until we require a more recent Boost because
2234
# upstream did not ship proper CMake files until 1.82.0.

0 commit comments

Comments
 (0)