diff -r 80ef3a206772 -r 48780e181b38 Symbian3/SDK/Source/GUID-AE3BE603-21ED-5DEA-B1E9-0F1ADBED06D0.dita --- a/Symbian3/SDK/Source/GUID-AE3BE603-21ED-5DEA-B1E9-0F1ADBED06D0.dita Fri Jul 16 17:23:46 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - - -Build-time variants

It is a common requirement to be able to build more than one variant of a program from a single set of source code. For example, you might have evaluation and full variants of a program that are identical in most respects, but which differ in a few features; or might want to build a program for more than one platform, with some features being present on platform but not on the other.

A traditional way to handle this requirement is to use the pre-preprocessor to conditionally include sections of code depending on whether a macro is set or not. For example:

#ifdef MY_FLAG - // code that is compiled if MY_FLAG exists -#else - // code that is compiled if MY_FLAG doesn't exists -#endif

Note that this is not always the best approach, as it can make code difficult to read and maintain. Alternative approaches to consider can include:

However, if conditional compilation is needed, you can configure the build tools to read a file that defines the macros to use. To do this:

When you use bldmake or abld on the command line, the build tools look for the variant.cfg file, and set any macros defined in the specified file. By adding/removing/changing the variant.cfg file in your build environment, you can alter which macros are set, and so how your project is built.

For IDE builds, the macros are set when the IDE project file is created, and not changed unless you recreate the IDE project file.

Note that you can use the macros in bld.inf and .mmp files as well as in C++ files: this allows you to conditionally specify projects, source files, etc.

\ No newline at end of file