From 8800b5acc1ef7abe6c5260ae0be5386b1d593a19 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 25 Jun 2025 18:45:43 +0100 Subject: [PATCH] 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. --- cmake/module/AddBoostIfNeeded.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmake/module/AddBoostIfNeeded.cmake b/cmake/module/AddBoostIfNeeded.cmake index ecd0d6f2aba..948021f5d5d 100644 --- a/cmake/module/AddBoostIfNeeded.cmake +++ b/cmake/module/AddBoostIfNeeded.cmake @@ -17,6 +17,18 @@ function(add_boost_if_needed) directory and other added INTERFACE properties. ]=] + if(CMAKE_HOST_APPLE) + find_program(HOMEBREW_EXECUTABLE brew) + if(HOMEBREW_EXECUTABLE) + execute_process( + COMMAND ${HOMEBREW_EXECUTABLE} --prefix boost + OUTPUT_VARIABLE Boost_ROOT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() + endif() + # We cannot rely on find_package(Boost ...) to work properly without # Boost_NO_BOOST_CMAKE set until we require a more recent Boost because # upstream did not ship proper CMake files until 1.82.0.