Conditional Processing in Builds

You can set up one configuration file so that it can perform different builds in different conditions. For example, you can set different build options depending on a condition you test during the build process. Any action that you can control in a configuration file can be conditional on any expression that you can specify in a configuration file. Often, the conditions depend on environment variables that are set outside the configuration file.

Use the if directive to code conditions in your configuration file. You can edit the configuration file from a Source view of the IDE.

Here is an example of an if directive:

if $OS2 {    // OS2 build
  option targetopts = commontargetopts, link(pmType, PM)
}
else {       // Windows build
   option targetopts = commontargetopts,
   link(linkWithSharedLib),
   link(subsystem, "WINDOWS")
}

You can process all directives conditionally by using them as subdirectives of an if directive.



Configuration Files
How Configuration Files Are Processed


Change a Build Setup (Configuration File)
Build


Configuration File Syntax
Build Options