cmakefmt
Configuration file for cmakefmt, a fast native CMake formatter
| Type | object |
|---|---|
| File match |
.cmakefmt.yaml
.cmakefmt.yml
.cmakefmt.toml
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/cmakefmt/latest.json |
| Source | https://cmakefmt.dev/schemas/latest/schema.json |
Validate with Lintel
npx @lintel/lintel check
The user-config file structure for .cmakefmt.yaml, .cmakefmt.yml, and
.cmakefmt.toml.
All fields are optional — only specified values override the defaults.
Properties
19 nested properties
Command names (lowercase) that must always use vertical layout regardless of line width.
Alignment strategy for a dangling ): prefix, open, or close.
Place the closing ) on its own line when a call wraps.
Disable formatting entirely and return the source unchanged.
How to handle fractional indentation when use_tabs is true: use-space or round-up.
Output line-ending style: unix (LF), windows (CRLF), or auto (detect from input).
Maximum rendered line width before cmakefmt wraps a call. Default: 80.
Maximum number of consecutive blank lines to preserve. Default: 1.
Maximum keyword/flag subgroups to keep in a hanging-wrap layout. Default: 2.
Maximum wrapped lines to tolerate before switching to a more vertical layout. Default: 2.
Maximum positional arguments to keep in a hanging-wrap layout. Default: 6.
Upper heuristic bound used when deciding between compact and wrapped layouts. Default: 10.
Maximum rows a hanging-wrap positional group may consume before nesting is forced. Default: 2.
Lower heuristic bound used when deciding between compact and wrapped layouts. Default: 4.
Return an error if any formatted output line exceeds line_width.
Insert a space before ( for control-flow commands such as if, foreach, while.
Insert a space before ( for function() and macro() definitions.
Number of spaces per indentation level when use_tabs is false. Default: 2.
Indent with tab characters instead of spaces.
11 nested properties
Preferred bullet character when normalizing markup lists. Default: *.
Normalize ruler comments when markup handling is enabled.
Enable markup-aware comment handling.
Preferred punctuation for numbered lists when normalizing markup. Default: ..
Regex pattern for inline comments explicitly trailing their preceding argument. Default: #<.
Regex describing fenced literal comment blocks.
Preserve the first comment block in a file literally.
Minimum ruler length before a hash-only line is treated as a ruler. Default: 10.
Regex for comments that should never be reflowed.
Reflow plain line comments to fit within the configured line width.
Regex describing ruler-style comments that should be treated specially.
Per-command configuration overrides keyed by lowercase command name.
{}
Definitions
How to normalise command/keyword casing.
How to align the dangling closing paren.
Only takes effect when [Config::dangle_parens] is true.
Controls where ) is placed when a call wraps onto multiple lines:
# Prefix / Close — `)` at the command-name column (tracks block depth):
target_link_libraries(
mylib PUBLIC dep1
)
# Open — `)` at the opening-paren column:
target_link_libraries(
mylib PUBLIC dep1
)
Command names (lowercase) that must always use vertical layout regardless of line width.
Alignment strategy for a dangling ): prefix, open, or close.
Place the closing ) on its own line when a call wraps.
Disable formatting entirely and return the source unchanged.
How to handle fractional indentation when use_tabs is true: use-space or round-up.
Output line-ending style: unix (LF), windows (CRLF), or auto (detect from input).
Maximum rendered line width before cmakefmt wraps a call. Default: 80.
Maximum number of consecutive blank lines to preserve. Default: 1.
Maximum keyword/flag subgroups to keep in a hanging-wrap layout. Default: 2.
Maximum wrapped lines to tolerate before switching to a more vertical layout. Default: 2.
Maximum positional arguments to keep in a hanging-wrap layout. Default: 6.
Upper heuristic bound used when deciding between compact and wrapped layouts. Default: 10.
Maximum rows a hanging-wrap positional group may consume before nesting is forced. Default: 2.
Lower heuristic bound used when deciding between compact and wrapped layouts. Default: 4.
Return an error if any formatted output line exceeds line_width.
Insert a space before ( for control-flow commands such as if, foreach, while.
Insert a space before ( for function() and macro() definitions.
Number of spaces per indentation level when use_tabs is false. Default: 2.
Indent with tab characters instead of spaces.
How to handle fractional tab indentation when [Config::use_tabchars] is
true.
Output line-ending style.
Preferred bullet character when normalizing markup lists. Default: *.
Normalize ruler comments when markup handling is enabled.
Enable markup-aware comment handling.
Preferred punctuation for numbered lists when normalizing markup. Default: ..
Regex pattern for inline comments explicitly trailing their preceding argument. Default: #<.
Regex describing fenced literal comment blocks.
Preserve the first comment block in a file literally.
Minimum ruler length before a hash-only line is treated as a ruler. Default: 10.
Regex for comments that should never be reflowed.
Reflow plain line comments to fit within the configured line width.
Regex describing ruler-style comments that should be treated specially.
Per-command overrides. All fields are optional — only specified fields override the global config for that command.
Override the command casing rule for this command only.
Override dangling paren alignment for this command only.
Override dangling paren placement for this command only.
Override the keyword casing rule for this command only.
Override the line width for this command only.
Override the hanging-wrap subgroup threshold for this command only.
Override the hanging-wrap positional argument threshold for this command only.
Override the indentation width for this command only.