Issue building swift on MacOS - CMAKE_OSX_SYSROOT pointing to SDK that I don't have installed

Afternoon,

I haven't built swift for a while and wanted to do the full toolchain build locally, so I wiped everything out and went through the process described in GettingStarted.

The checkout worked great, everything updated - but when I try to do a basic build, both with Ninja and Xcode, I run into failures as the code appears to be looking for the 11.3 macOS SDK - but that doesn't exist in the current release of Xcode.

In particular, I receive a prominent CMake warning:

  Ignoring CMAKE_OSX_SYSROOT value:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

and then the error:

CMake Error at /opt/homebrew/Cellar/cmake/3.21.4/share/cmake/Modules/FindSQLite3.cmake:45 (file):
  file STRINGS file
  "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/sqlite3.h"
  cannot be read.
Call Stack (most recent call first):
  CMakeLists.txt:29 (find_package)

Looking at my filesystem — with Xcode Version 13.1 (13A1030d) — the only macOS SDK that's included is MacOSX12.0.sdk

Without knowing how to set the appropriate CMake variables through, I tried setting an environment variable with the same name to the SDK that I do have:
export CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk, but that didn't appear to get picked up by the build scripts and/or CMake.

(cmake is version 3.21.4, installed from homebrew - along with Ninja and SCCache per the suggestions in getting started)

What's the best way to get the right SDK location into place so that the relevant tooling can find the appropriate headers?