Creating Build Events

From RAD Studio
Jump to: navigation, search

Go Up to How To Compile and Build Applications

You can use the Build Events dialog box to specify commands and events that are to occur in various stages of the build process. Depending on the type of project, you can specify a list of commands to be executed for the post-build, pre-link, and pre-build stages. You enable or disable events for any of these stages in the Build Events dialog box.

To create a list of build events and commands

  1. Choose Project > Options > Build Events.
  2. Locate the build phase for which you want to add build events and commands. You can choose from:
    • Post-build events
    • Pre-build events
    • Pre-link events
  3. For the build phase of interest, enter any commands you want and enable events as follows:
    1. Commands: Enter the build commands that you want the command shell to process in that build phase. There are two ways to enter commands:
      • Type the commands directly in the Commands entry field on the Build Events dialog box.
      • Use the larger edit field and useful macro list available on the Build Event Commands dialog box (an <ordered_list> dialog box):
        • To open the Build Event Commands dialog box, either double-click the Commands entry field, or click the field and then click the ellipsis [...] that appears. You can edit your command string in the upper half of the Build Event Commands dialog box.
        • Commands consist of any valid DOS command, such as:
          copy $(OutputPath) c:\Built\$(OutputName).
        • You can enter commands one command per line (pressing Return after each command), or you can continue commands by separating them with an ampersand (&).
        • To add a predefined macro to your command (such as OUTPUTDIR), double-click the macro name in the Macros list, located in the lower half of the Build Event Commands dialog box.
    2. Events: Enable specific events for the build phase:
      • Cancel on error - Cancels the build if an error occurs. Select either True or False
      • Execute when (only supported for Post-build events) - Specifies when to execute the commands you have specified. Select either:
        • Always (the commands are executed after every build)
        • Target is out of date (the commands are executed only when changes have been made to the project)
  4. After you have finished entering commands and enabling events for each phase, click OK.

When you do a build, the commands and their results are displayed in the Output pane of the Messages View.

See Also