I have chosen to still build with autobuild version1.0 because it makes it easer to have control over configuration compared to the variables settings file used in later versions. Besides when you only build 64-bit targets; anyway...
a) I assume you are on macOS 12.5 and with Xcode 13.4.1?
b) do you use homebrew or macports? – I use macports because homebrew is in many ways a linux hack made to work on macOS, while macports is BSD, which is also the BSD Unix subsystem in macOS. I find there is better compatibility with macports.
c) I use cmake 3.23.0 right now, but I believe you must be on 3.19.x minimum for it to properly resolve the sysroot when building on Apple Silicon
d) In my Variables.cmake I have a line for Darwin with
set(CMAKE_OSX_SYSROOT macosx)
You can try and set your -iwithsysroot to macosx on line 61 in your FS variables file, rather than the full patch to the SDK
e) Do you build from the command line?
If so, does it make any difference if you open the project in Xcode and build it there?
If you do build in Xcode, make sure to edit the Product>Scheme>Edit Scheme.. and set Build Configuration to Release with Executable to None
If you open the generated project in Xcode, the Build Settings>Architectures shall be set to:
Additional SDKs not set (blank)
Architectures x86_64 (it also works with arm64 as long as cmake has generated build files for x86_64)
Base SDK macOS
Build Active Architectures Only No
Excluded Architectures not set (blank)
Supported Platforms macOS
In addition macOS Deployment Target must be set to macOS 10.13 or higher or you will get an error message that the deployment target is not supported by the SDK
Finally, yes, you will have to change the code in quite a few places to make it build on Xcode 13.2 or higher