--- a/CMakeLists.txt 2026-07-22 18:39:09 +++ b/CMakeLists.txt 2026-07-22 18:50:13 @@ -1784,12 +1784,12 @@ ) IF(APPLE) - # Homebrew default location is - IF(APPLE_ARM) - SET(HOMEBREW_HOME "/opt/homebrew/opt") - ELSE() - SET(HOMEBREW_HOME "/usr/local/opt") - ENDIF() + # MacPorts build: disable MySQL's Homebrew auto-detection by pointing + # HOMEBREW_HOME at a non-existent prefix, so MySQL never inserts Homebrew + # paths (the system include dir, icu/fido/ssl/bison HINTS, the protobuf + # dependency filter, and the Homebrew-boost FATAL_ERROR check) ahead of + # the MacPorts prefix. + SET(HOMEBREW_HOME "/nonexistent/opt") # The Xcode version is 1.2.12 which is too old LIST(REMOVE_ITEM SYSTEM_LIBRARIES ZLIB) # Link with the correct version of libc++.dylib @@ -2108,6 +2108,17 @@ BREAK() ENDIF() ENDFOREACH() + # MacPorts build: upstream exposes the bundled boost only as INTERFACE include + # directories on the extra::boost target, and cmake appends those after the + # directories a target inherits from this one. Any WITH_*=system dependency + # whose headers live directly in ${prefix}/include therefore puts that prefix + # ahead of extra/boost/${BOOST_PACKAGE_NAME} in the search order, and an + # installed MacPorts boost port shadows the bundled copy MySQL requires. + # Upstream guards against exactly this for Homebrew with the FATAL_ERROR + # above, which we disable along with the rest of the Homebrew handling; + # prepend the bundled boost here instead so it always wins. This must come + # after every MYSQL_CHECK_* above and before the ADD_SUBDIRECTORY calls below. + INCLUDE_DIRECTORIES(BEFORE SYSTEM ${BOOST_INCLUDE_DIR}) ENDIF() IF(WITH_AUTHENTICATION_WEBAUTHN OR