How can I make the Xcode generator create a project with folders in alphabetical order?

Is there a way to make the Xcode generator to create a project with the folders in alphabetical order? We have a very large project and it seems the folders end up in the order they are found when the generation is done.

It is, of course, possible to manually right-click on the parent folder in Xcode and Sort by name, but it is both slow (large project, many targets and folders) and you have to do for every parent folder.

I know there is an issue about this (issue #1631), but that is now closed because the issue is regarded as fixed—which is it not for us.

This has been an issue for us for a long time, but at the moment I am using CMake 3.29.0 and Xcode 15.3.

That issue is about VSCode, not Xcode. I don’t know what level of control CMake has over Xcode here, but you might be able to ask Apple as well through their channels.


This is CMake Issue 21659.