Exported Custom Xcode Flags require sorting by dependency

Projucer-generated Xcode projects use a folder ‘build’ inside the source tree by default. There are however good reasons to keep temporary build files aside from the project sources. To achieve this, I first tried to use Custom Xcode Flags:


This worked only to some extent. Some temporary files were still created in ‘build’ next to the project sources. This may be because SYMROOT has dependencies and shouldn’t be put somewhere at the bottom with other Custom Xcode Flags.

The only remedy for me was to patch Projucer and add this to getProjectSettings()

s.set ("SYMROOT", addQuotesIfRequired("$(BUILDS)/Projects/$(PROJECT_NAME)"));

Obviously, patching Projucer with hard-wired specifics isn’t ideal.

Pointing SYMROOT to somewhere outside the project sources should be a very common case.

I suggest to add a method in Projucer that sorts all generated flags by dependency where that applies. SYMROOT is one obvious example, but there may be others. This method will be easily maintainable as more flags emerge over time that are sensitive to ordering.

It might suffice to simply define a constant list of keys that require to be moved to the top.