I am developing a new module for a large Application in Delphi 2010.
I have organized my sources in a project group of two projects, one to build the full application and one two launch my test suite (which shares some sourcecode with the main application).
During the initalization of a unit, i need to act differently depending on which of the two i was compiling.
unit MySharedUnit
var
flag : TFlagValues;
implementation
[...]
initialization
if IsTestProject then
flag := TestValue
else
flag := ReleaseValue;
end.
Currently, I use a project defined environment variable (defined in only one of the projects' options) to decide the active project.
My question is:
Is there another or more elegant way to do this, like a builtin #define'd value or so which would not require me to modify the project options by hand when the test application should be run in Release mode?