But that’s a problem now, anyway - if you move your project’s position, you STILL have to update all the includes. In fact, that’s pretty well always a problem. Try moving your XCode project into a subdirectory… 
but…
YES, ten times better! DO IT DO IT DO IT! (or, I might do it - see below…)
Comments…
- make the expansion syntax accept either $XXX or ${XXX} - or if you can only do one, do the second. There’s inevitably the day you want to say $FOO_bak where your variable is FOO.
- I think you could simply add this facility to EVERY text string in the JUCER for not-so-much-more work - you’d simply derive from TextPropertyComponent and just expand the template before return the value…!
- And if you’re going to do that, why not add another line to the project/config: “Template variable assignments” - so I can just set my own template variable here, and then use it in my various assignments later? You could use a format just like for symbol definitions to the compiler.
So I’ve actually been fiddling with the Experimental JUCER (it’s experimental, right, so I get to experiment with it??) and might send you, Jules, some changes, but let me tell you what I’m thinking.
If you take the suggestion above, there are at least four fields that can really be defined at EITHER the project level OR the build level. These fields are extra linker flags, extra compiler flags, header include paths and template variable assignments.
In fact, IMHO the way linker and header flags are put right now is exactly backward. So far, all my header include paths are the same for all (well, both) my configurations, so I have to copy that field exactly in two places. On the other hand, the fact that there’s only one field for the extra linker flags over all configurations means that there is no way to link to debug libraries in debug and release libraries in release.
My solution to this would be to include these four fields, and perhaps others, in three places in the JUCER - one at the project level, one at the configuration level, and one at the “target” level (I’m not sure what you call the “Mac OS vs Windows vs Linux vs…” level). There would be a set of default variables (e.g. JUCE_HOME), then the project level could override those and the configuration level could override those and finally the “target” level would override those.
Using my current case as an example, which I believe is pretty generic, I’d set all my include file paths in the project. I have debug and release versions of the libraries I use, so in the e.g. Debug configuration level I’d set the extra linker flag -L$JUCE_ROOT/libfoo/Debug - but I’d set the actual library names themselves in the project: -lfoo
(Actually, there would probably be some variable indicating the configuration so you could bring up that extra linker flag to be -L$JUCE_ROOT/libfoo/$CONFIG and define it, too at the project level…)
Oops!
Ah, this clears up a lot of things. I’ll just get rid of the direct includes…
but I do feel fairly strongly that including everything is not a good idea - I put in the direct includes not just because it’s simply very useful for documentary purposes, but because in a world where you “include [exactly] what you use”, this results in decreased compilation times (though I do understand that your headers are pre-compiled).
All those macros that control the inclusion of parts of your system would simply be unneeded if you only included what you needed - and if you used forward references for any classes that are mentioned in headers but not exposed, you’d get an even smaller compile time, but also, a system with parts where software breakage is much more confined. (I do understand that there are serious historical reasons for the universal include and that backward compatibility trumps all…)
Once you’re simply “including what you use” you have a lot more flexibility to use templates and inline functions without killing your compilation time, and the optimizer can have a field day.
This is definitely the Google heritage speaking - “include what you use” became very important as the system got bigger - but I’ve kept that where I’ve dropped other Google things because I find it so clear and useful. I think it’s no coincidence that my two other primary languages, Java and Python, both require “include what you use” (and Java essentially enforces the “exactly” as it’s a compiler warning you can “make go away” with a keystroke).