Filling "External Linker Flags" via a shell command

I need to take the output of llvm-config --libs and use it to fill the “Extra Linker Flags” section of an Xcode project being generated by the Projucer. I’m pretty new to JUCE (and also Xcode when it comes to C++ projects…) so I’m not sure what the best way to about this is.

Right now I’m thinking of using an xcconfig file and then generating that by a pre-build script, but I’m wondering if there’s a more direct way. Maybe the Projucer can do it as part of the Xcode exporter somehow?

That’s what I was going to suggest, but only if you are using Projucer for bootstrapping your project.

If you’re using it to actively maintain your project, then the xcconfig route does not seem to be possible because Projucer will overwrite your Xcode project every time you save, discarding all information about xcconfig files to be used (which is a pity).

Even better would be (it’s the n-th time that I’m repeating this, in the hope of gaining support with the idea) if Projucer wrote its Xcode settings to a xcconfig file rather than directly into the Xcode project.

1 Like

That’s exatly the dilemma. It would definitely be nice if JUCE wrote / updated an xcconfig file for settings, but that’s probably a long shot…

1 Like

Ended up finding a solution. Fortunately the code I was trying to use was from a custom JUCE module and so I added a Makefile to generate the OSXLibs field based on the output of llvm-config.

1 Like