Main Content

findIncludeFiles

Find and add include (header) files to build information

Description

findIncludeFiles(buildInfo,extensions,Name,Value) searches for and adds include files to the build information.

Use the findIncludeFiles function to:

  • Search for include files in source and include paths from the build information.

  • Apply the optional extensions argument to specify file name extension patterns for search.

  • Add the found files with their full paths to the build information.

  • Delete duplicate include file entries from the build information.

To ensure that findIncludeFiles finds header files, add their paths to buildInfo by using the addIncludePaths function.

Note

findIncludeFiles can modify the buildInfo argument. These modifications are reflected in further use of buildInfo, including in subsequent calls to findIncludeFiles.

example

Examples

collapse all

Find include files with file name extension .h that are in the build information, myBuildInfo. Add the full paths for these files to the build information. View the include files from the build information.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo,{fullfile(pwd,...
   'mycustomheaders')},'myheaders');
findIncludeFiles(myBuildInfo);
headerfiles = getIncludeFiles(myBuildInfo,true,false);
>> headerfiles

headerfiles = 

    'W:\work\mycustomheaders\myheader.h'

Input Arguments

collapse all

Object provides information for compiling and linking generated code.

To specify files for the search, the character vectors or strings in the extensions argument:

  • Must start with an asterisk immediately followed by a period (*.)

  • Can include a combination of alphanumeric and underscore (_) characters

Example: '*.h' '*.hpp' '*.x*'

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: minimalHeaders=false,ignoreParseError=true

Option to include only minimally required header files, specified as true or false.

Based on the value of minimalHeaders, findIncludeFiles determines which header files to include and updates buildInfo accordingly.

  • If minimalHeaders is true, findIncludeFiles analyzes the source code to determine which header files are required to build the code, and only these header files are included.

  • If minimalHeaders is false, all header files found on the include paths specified by buildInfo are included.

Example: minimalHeaders=false

If false, terminate on parse errors.

If true, do not terminate on parse errors.

Example: ignoreParseError=true

Version History

Introduced in R2006b