CMake 3.19 / Xcode 12 fails when cross-compiling for iOS unless -T buildsystem=1 is specified

From the CMake 3.19 release notes:

The Xcode generator now uses the Xcode “new build system” when generating for Xcode 12.0 or higher. See the CMAKE_XCODE_BUILD_SYSTEM variable. One may use -T buildsystem=1 to switch to the legacy build system.

When I’m cross-compiling for iOS with CMake 3.19 and Xcode 12, using the new build system causes the build to consistently fail with this error message:

error: unable to attach DB: error: accessing build database "/path/to/project/build/ios/build/XCBuildData/build.db":
  database is locked Possibly there are two concurrent builds running in the same filesystem location.

The issue seems to be a post-build rule that CMake creates for the install target. In that post-build rule a second build is initiated while the first one is still in progress.

For the moment I can make the build work again by specifying -T buildsystem=1, but this seems to be a temporary workaround only, because Xcode’s legacy build system has been deprecated and, knowing Apple’s relentless innovation drive, will go away rather sooner than later.

Is there a better way how to make cross-compiling for iOS work again without having to resort to -T buildsystem=1?

Also the iOS cross-compiling section on the cmake-toolchains docs page fails to mention -T buildsystem=1 - it would be nice to update the page with a hint.

Please try CMake 3.19.2 with Xcode 12.2 or later, I think this has already been fixed.

I don’t think this is already fixed. My question/report already is for CMake 3.19.2 (installed via Homebrew) and Xcode 12.3. The OS is macOS Big Sur 11.1. Sorry for not being more specific.

Could you please report a new issue in CMake’s issue tracker for this. Include as much detail as you can about your system, versions used, etc. including different variations you’ve tried. This sounds like a combination that should already be covered by nightly builds, so I’m surprised it doesn’t work. There may be something slightly different about your setup compared to what has been tested so far.

Thanks for the issue tracker link. I found issue 21282 which exactly describes my problem. The issue is still open so I didn’t create a new one.

Apologies for wasting time here in the forum, I should have searched the tracker first before posting here.