Is it possible to use system or project macros within code?
For example, we have three project configurations: Dev_Debug, Dev_Release, Formal_Release.
Every one of our projects/products has these configurations. Is there a way to use $(Configuration) within code so that I can then make slight code changes based on the build type?
e.g.
var build_type;
#if $(Configuration) == "Dev_Debug"
build_type = 'B';
#elseif $(Configuration) == "Dev_Release"
build_type = 'D';
#elseif $(Configuration) == "Formal_Release"
build_type = 'R';
#endif
I know the above method won't work, it's just an example of what I'd like to achieve, the exclusion/inclusion of code sections.
There seems to be a similar application here http://rowley.zendesk.com/forums/56662/entries/111211-get-the-build-date-and-time-from-within-my-program but I can't quite figure out how to use the $(Configuration) macro using the above sort of method.
Any ideas?
Thanks
-
As long as your configuration names don't have any spaces in them (which appears to be the case), you could do something like add a "CONF_$(Configuration)" preprocessor definition. Then you could use the following code:
#if defined(CONF_Dev_Debug)
...
#elif defined(CONF_Dev_Release)
...
#elif defined(CONF_Formal_Release)
...
#endif
Please sign in to leave a comment.
Comments
4 comments