genPCH C File Option

Syntax: Default:
file(genPCH[, yes])
file(genPCH, pathName)
file(genPCH, no)
file(genPCH, no)

This option determines whether the C compiler generates a precompiled header file, and optionally names that file.

By default no precompiled header file is produced.

When you specify file(genPCH), but not file(usePCH), a precompiled header file is always produced. When you specify both file(genPCH) and file(usePCH), the precompiled header file is produced only if does not already exist or is out of date.

If you do not supply a name, the precompiled header file is named csetc.pch.

When file(genPCH, pathName) is specified, pathName can be the relative or absolute path name of either a file or a directory.  If you supply a file name, the name of the output file created will be pathName.  In this case, supply a different file name for every source that does not share a common header file. Otherwise the output is overwritten by every file compiled after the first source because the same output file name is used for each source.  If you supply a directory name, the precompiled header files created are placed into that directory.

To use the precompiled header files, use file(usePCH). Specify both file(genPCH) and file(usePCH) to keep precompiled header files up to date. If you specify different file names with the two options, the name specified last is used for both options.

You can also use #pragma hdrfile in your source, to request precompiled headers. The file name in the pragma overrides the file name specified with this option.

This option is implicitly set to no when file(syntaxOnly) or pp(preprocessOnly) are in effect.



C Compilation
Configuration Files
Precompiled C Headers
Organizing Your C Source for Precompiled Headers


Set Build Options
Build


C File Options