Main Content

setTargetProvidesMain

Disable inclusion of code generator provided (generated or static)main.csource file during build

Description

example

setTargetProvidesMain (buildinfo,providesmain)disables the code generator from including a samplemain.csource file.

To replace the samplemain.cfile from the code generator with a custommain.cfile, call thesetTargetProvidesMainfunction during the'after_tlc'case in theert_make_rtw_hook.morgrt_make_rtw_hook.mfile.

Examples

collapse all

To apply thesetTargetProvidesMainfunction:

AddbuildInfoto the arguments in the function call.

functionert_make_rtw_hook(hookMethod,Name,rtwroot,...templateMakefile,buildOpts,buildArgs,buildInfo)

Add thesetTargetProvidesMainfunction to the'after_tlc'stage.

case'after_tlc'% Called just after to invoking TLC Compiler (actual code generation.)% Valid arguments at this stage are hookMethod, Name, and% buildArgs, buildInfo%setTargetProvidesMain (buildInfo,true);

Use theConfiguration Parameters>Code Generation>Custom Code>Source Filesfield to add your custommain.cto the project. When you indicate that the target providesmain.c, the project requires this file to build without errors.

Input Arguments

collapse all

Theprovidesmainargument specifies whether the code generator includes a (generated or static)main.csource file.

  • false— The code generator includes a samplemain.objobject file.

  • true— The target provides themain.csource file.

Version History

Introduced in R2009a

See Also