Hello,
I'm tackling the issue: #18959
Initial discussion: #18743 (comment)
I was not able to remove the xcrun invocation to get the SDK path. All others removed.
We can see below how this behaves when multiple Xcode are present and we switch among them.
$ sudo xcode-select --switch /Applications/Xcode11.7.app
$ make -C depends print-darwin_CXX
darwin_CXX = clang++ -mmacosx-version-min=10.14 -stdlib=libc++ --sysroot /Applications/Xcode11.7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
$ clang++ -mmacosx-version-min=10.14 -stdlib=libc++ --sysroot /Applications/Xcode11.7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode11.7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ sudo xcode-select --switch /Applications/Xcode12.3.app/
$ make -C depends print-darwin_CXX
darwin_CXX = clang++ -mmacosx-version-min=10.14 -stdlib=libc++ --sysroot /Applications/Xcode12.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
$ clang++ -mmacosx-version-min=10.14 -stdlib=libc++ --sysroot /Applications/Xcode12.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --version
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode12.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin