In the code below, I would like the value of THE_VERSION_STRING taken from the value of the environment variable MY_VERSION at compile time
namespace myPluginStrings { const char* pluginVendor = "me"; const char* pluginRequires = THE_VERSION_STRING; };
So if I print:
export MY_VERSION="2010.4"
pluginRequires will be set to "2010.4" even if MY_VERSION is set to something else at runtime.
UPDATE: (feb 21) Thanks for all your help. It works. Since I use Rake as a build system, each of my CFLAGS is a ruby ββvariable. Values ββmust also end with quotation marks. So for the gcc command line, I need to look like this:
gcc file.c -o file -D"PLUGIN_VERSION=\"6.5\""
What does this mean in my rakefile:
"-D\"PLUGIN_VERSION=\\\"#{ENV['MY_VERSION']}\\\"\""
c ++ c-preprocessor environment-variables substitution
Julian mann
source share