Xcode 13 build failure with projects generated with the legacy build system option
With Xcode 13 Apple seems to be more aggressively discouraging the legacy build system. In addition to selecting the legacy build system, you also have to check the new "Do not show a diagnostic issue about build system deprecation" option under the project settings. Failure to make this project change will result in a build error instead of just a warning.
When generating Xcode projects with cmake it is possible to specify the legacy build system via the -T buildsystem=1
option. But cmake currently does not also set this new option that allows the legacy build system to be used under Xcode 13. As a result, cmake generated projects with the legacy build system option do not build without manual changes after generation.
Note that I tested cmake 3.20.5. There doesn't seem to be an indication that this is fixed in a new version of cmake, as near as I can tell.
It should be safe for a new version of cmake to set both options in the WorkspaceSettings.xcsettings
XML file when the legacy build system is selected. Older versions of Xcode should ignore the new option that they don't know about. And without setting both options, the generated project will fail to build under Xcode 13. While you could allow the setting of the second option separately, there seems to be little value in doing so.
This is the new option that needs to be added to WorkspaceSettings.xcsettings
file:
<key>DisableBuildSystemDeprecationDiagnostic</key>
<true/>
Here's a complete WorkspaceSettings.xcsettings
file with both settings (please ignore the unrelated PreviewsEnabled
option):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>DisableBuildSystemDeprecationDiagnostic</key>
<true/>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
We're stuck using the legacy build system for now. We hope we can move to the new build system in the future. But in the meantime we cannot use cmake generated projects under Xcode 13 without manual intervention.
Thanks in advance for any help with this issue.