RAD Studio (Common)
ContentsIndex
PreviousUpNext
Option Sets Overview

Both C++Builder 2009 and Delphi for Win32 2009 support the use of option set files for managing build configurations. Previously, only C++Builder 2007 supported option sets. Also new for 2009 is the ability to apply an option set to a build configuration by reference, as described in this topic.  

Option sets are disk files that contain the values you have set for build-related project options. Option sets are saved in files with the extension .optset, in your project folder. You can an apply option set to the current build configuration either by reference or by value. After you apply an option set by reference, the option set is listed in the Project Manager under that configuration. You must save changes to the project in order to save the reference to the option set in the project.

You can create an option set by using the New Option Set command in the context menu in the Project Manager. Similarly, you can edit an existing option set by using the Edit context-menu command in the Project Manager. In both situations, the Project Options dialog box opens, enabling you to view and adjust the values for the options in the option set.

Both option sets and build configurations consist of sets of option values related to the MSBuild project file. The main distinction is that build configurations are saved in the project file, while option sets are saved in .optset XML files independent of projects.  

Saving and building a project saves changes to its build configurations, but option sets are saved separately (using the Save As button on ProjectOptions pages). Changing a project's configurations and adding or deleting configurations does not affect option sets. Similarly, saving option sets does not change configurations.  

Option sets can be applied to build configurations – either by reference or by value. Each project has its own list of build configurations as well as a list of option sets that you have added by reference, independent of other projects. Option sets that are added by value have no continuing affect on the project. You can access any option set file from any project.

Any given configuration or option set might not contain values for all possible project options. When you save an option set, only the values that are different from the parent configuration are saved — not values for every option. 

For instance, suppose you have a project open in the IDE and the active configuration is the Debug configuration. You change one option and then save the option set. The only option values that are saved in the option set file are the one option value you changed plus any option values in the Debug configuration that are different from the defaults (these changed values are shown in boldface print in the ProjectOptions. dialog box).

You can apply the values of an option set (an .optset file) to any configuration in any project by using the Apply Option Set dialog, available by selecting the Load button on the ProjectOptions dialog box.  

You can apply an option set in either of the following two ways:

  • As a reference (so that the option values in the configuration are updated whenever the parent option's value changes in the option set file)
  • By modifying the configuration's values (so that the option values in the configuration are changed only once and do not refer to the parent option set)
 

 

Applying an Option Set as a Reference

When you select the Add as reference option on the Apply Option Set dialog box, the values in the option set are added to the current configuration and replace only those values, not affecting any of the options that have no specific value set in the option set you are applying. 

If you change the option set later, the change is also made to any of the configuration's values that derived from that option set. This enduring association between an option set and a build configuration is established when you apply the option set as a reference. In the Project Manager, an option set that was applied by reference is listed under the node of the associated build configuration.

Modifying a Build Configuration by Applying an Option Set by Value

When you select the Modify this configuration option on the Apply Option Set dialog box, the values in the option set are applied to the current build configuration (the configuration listed in the Build Configuration field on the ProjectOptions dialog box).  

This is a one-time application of values, and no other connection exists between the configuration and the option set. If you change the option set later, the build configuration is not affected. 

The option set values are applied to the current build configuration according to the priority you select, as follows:

  • Replace all values results in a build configuration that is an exact copy of the option set.
  • Option set file adds the values of the option set to the current build configuration but does not change any other option values in the configuration.
  • This configuration retains the values in the current build configuration and adds only those values from the option set for which no value is set in the build configuration.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!