Hi,
depending on a compile switch (values are COMPILE_A
or COMPILE_B
), which is set in the form of an envorinment variable, I want to compile my application with different settings, like application name and splash screen.
I got this far:
In "Project / Settings / C/C++ / Preprocessor Definitions" I added
$(COMPILESWITCH)
(results in command line option/D "$(COMPILESWITCH)"
).In stdafx.h I can use the following code, which means I correctly defined the preprocessor definition via the command line parameter:
#if defined COMPILE_A
# define IDB_SPLASH IDB_SPLASH_A
# elif defined COMPILE_B
# define IDB_SPLASH IDB_SPLASH_B
# else
# error Unknown or undefined target compile switch; cannot compile!
# endif
But I've noticed the "Condition" property under "ResourceView / [right-click] / Properties"... The help text says this:
ConditionDetermines the inclusion of the resource. For example, if the condition is _DEBUG, this resource would be included only in debug builds.
This looks like the elegant way of doing it, right?
Specifiying _DEBUG
as condition works. So as _DEBUG
is specified via /D _DEBUG
my $(COMPILESWITCH)
should also work, right?
For some reason it doesn't; why?
Or is there even another, better way to achieve what I want?