Skip to content

Commit 8800b5a

Browse files
committed
cmake: Explicitly specify Boost_ROOT for Homebrew's package
On macOS, this change ensures that the Boost package is located at its real path rather than via the symlink in the default prefix.
1 parent 7d5a6d1 commit 8800b5a

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)