I am writing an OpenGL app which runs on windows, OSX and linux.
I have some free-for-commercial-use truetype fonts that I'm packaging with the app, so the user can choose their preferred font for the text part of my renders.
I have some glsl shaders of my own making, so that my rendering does just the right thing. I need to package these with the app, too
I build with cmake and build an installer with cpack. I use the install command to control where the fonts and shaders go, on the target machine.
I have C++ code which, given a path to a font file, will give me just the right font in the rendered image. Similarly, I have OpenGL code which needs to know where the shaders are, at runtime.
On the build machine I've used configure_file to handle OS/user variations. The fonts and shaders are relative to a directory where the code resides, so I can put their location into a header file as a namespace variable, and the shading and font code can always find them.
Now I'm trying to get the installed app to work I've hit a problem: I can put my fonts and shaders anywhere I like on the target machine, at install time, but am struggling to see how the runtime (installed) executable, on the target machine, can be made to understand where that location is.
Compiler flag? Environment variable? Target property? None of them seems to quite fit the bill. Or is that wrong? Any thoughts would be very much appreciated.