Main Content

addLinkFlags

Add link options to build information

Description

addLinkFlags(buildinfo,options,groups) specifies the linker options to add to the build information.

The function requires the buildinfo and options arguments. You can use an optional groups argument to group your options.

The code generator stores the linker options in a build information object. The function adds options to the object based on the order in which you specify them.

example

Examples

collapse all

Add the linker -T option to the build information myBuildInfo and place the option in the group OPTS.

myBuildInfo = RTW.BuildInfo;
addLinkFlags(myBuildInfo,'-T','OPTS');

Add the linker options -MD and -Gy to the build information myBuildInfo and place the options in the group OPT_OPTS.

myBuildInfo = RTW.BuildInfo;
addLinkFlags(myBuildInfo,'-MD -Gy','OPT_OPTS');

For a non-makefile build environment, add the linker options -MD, -Gy, and -T to the build information myBuildInfo. Place the options -MD and-Gy in the group Debug and the option -T in the groupTemp.

myBuildInfo = RTW.BuildInfo;
addLinkFlags(myBuildInfo, {'-MD -Gy' '-T'}, ...
   {'Debug' 'Temp'});

Input Arguments

collapse all

RTW.BuildInfo object that contains information for compiling and linking generated code.

You can specify the options argument as a character vector, as an array of character vectors, or as a string. You can specify the options argument as multiple compiler flags within a single character vector, for example '-MD -Gy'. If you specify the options argument as multiple character vectors, for example, '-MD -Gy' and '-T', the options argument is added to the build information as an array of character vectors.

Example: {'-MD -Gy' '-T'}

You can specify the groups argument as a character vector, as an array of character vectors, or as a string. If you specify multiple groups, for example, 'Debug' 'Temp', the function relates the groups to the options in order of appearance. For example, the options argument {'-MD -Gy' '-T'} is an array of character vectors with two elements. The first element is in the 'Debug' group and the second element is in the Temp' group.

Example: {'Debug' 'Temp'}

Version History

Introduced in R2006a