
CMake tries to use Xcode if MACOSX_DEPLOYMENT_TARGET is set but that can lead to build failures when SDKROOT isn't set. The CMake behavior at minimum manifests as -isysroot spontaneously being set to the Xcode SDK, which brew sometimes can't successfully fully unwind with its ENV hacks.