| 1 |
# ---------------------------------- |
| 2 |
# Options affecting listfile parsing |
| 3 |
# ---------------------------------- |
| 4 |
with section("parse"): |
| 5 |
|
| 6 |
# Specify structure for custom cmake functions |
| 7 |
additional_commands = { |
| 8 |
'parse_version': { |
| 9 |
'kwargs': { |
| 10 |
'VERSION_STRING': '*' |
| 11 |
} |
| 12 |
}, |
| 13 |
'get_version_from_tag': { |
| 14 |
'kwargs': { |
| 15 |
'DEFAULT_VERSION_STRING': '*', |
| 16 |
'VERSION_PREFIX': '*', |
| 17 |
'GIT': '*' |
| 18 |
} |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
# Override configurations per-command where available |
| 23 |
override_spec = {} |
| 24 |
|
| 25 |
# Specify variable tags. |
| 26 |
vartags = [] |
| 27 |
|
| 28 |
# Specify property tags. |
| 29 |
proptags = [] |
| 30 |
|
| 31 |
# ----------------------------- |
| 32 |
# Options affecting formatting. |
| 33 |
# ----------------------------- |
| 34 |
with section("format"): |
| 35 |
|
| 36 |
# Disable formatting entirely, making cmake-format a no-op |
| 37 |
#disable = True |
| 38 |
|
| 39 |
# How wide to allow formatted cmake files |
| 40 |
line_width = 120 |
| 41 |
|
| 42 |
# How many spaces to tab for indent |
| 43 |
tab_size = 4 |
| 44 |
|
| 45 |
# If true, lines are indented using tab characters (utf-8 0x09) instead of |
| 46 |
# <tab_size> space characters (utf-8 0x20). In cases where the layout would |
| 47 |
# require a fractional tab character, the behavior of the fractional |
| 48 |
# indentation is governed by <fractional_tab_policy> |
| 49 |
use_tabchars = False |
| 50 |
|
| 51 |
# If <use_tabchars> is True, then the value of this variable indicates how |
| 52 |
# fractional indentions are handled during whitespace replacement. If set to |
| 53 |
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set |
| 54 |
# to `round-up` fractional indentation is replaced with a single tab character |
| 55 |
# (utf-8 0x09) effectively shifting the column to the next tabstop |
| 56 |
fractional_tab_policy = 'use-space' |
| 57 |
|
| 58 |
# If an argument group contains more than this many sub-groups (parg or kwarg |
| 59 |
# groups) then force it to a vertical layout. |
| 60 |
max_subgroups_hwrap = 3 |
| 61 |
|
| 62 |
# If a positional argument group contains more than this many arguments, then |
| 63 |
# force it to a vertical layout. |
| 64 |
max_pargs_hwrap = 6 |
| 65 |
|
| 66 |
# If a cmdline positional group consumes more than this many lines without |
| 67 |
# nesting, then invalidate the layout (and nest) |
| 68 |
max_rows_cmdline = 2 |
| 69 |
|
| 70 |
# If true, separate flow control names from their parentheses with a space |
| 71 |
separate_ctrl_name_with_space = False |
| 72 |
|
| 73 |
# If true, separate function names from parentheses with a space |
| 74 |
separate_fn_name_with_space = False |
| 75 |
|
| 76 |
# If a statement is wrapped to more than one line, than dangle the closing |
| 77 |
# parenthesis on its own line. |
| 78 |
dangle_parens = False |
| 79 |
|
| 80 |
# If the trailing parenthesis must be 'dangled' on its on line, then align it |
| 81 |
# to this reference: `prefix`: the start of the statement, `prefix-indent`: |
| 82 |
# the start of the statement, plus one indentation level, `child`: align to |
| 83 |
# the column of the arguments |
| 84 |
dangle_align = 'prefix' |
| 85 |
|
| 86 |
# If the statement spelling length (including space and parenthesis) is |
| 87 |
# smaller than this amount, then force reject nested layouts. |
| 88 |
min_prefix_chars = 4 |
| 89 |
|
| 90 |
# If the statement spelling length (including space and parenthesis) is larger |
| 91 |
# than the tab width by more than this amount, then force reject un-nested |
| 92 |
# layouts. |
| 93 |
max_prefix_chars = 10 |
| 94 |
|
| 95 |
# If a candidate layout is wrapped horizontally but it exceeds this many |
| 96 |
# lines, then reject the layout. |
| 97 |
max_lines_hwrap = 2 |
| 98 |
|
| 99 |
# What style line endings to use in the output. |
| 100 |
line_ending = 'unix' |
| 101 |
|
| 102 |
# Format command names consistently as 'lower' or 'upper' case |
| 103 |
command_case = 'canonical' |
| 104 |
|
| 105 |
# Format keywords consistently as 'lower' or 'upper' case |
| 106 |
keyword_case = 'unchanged' |
| 107 |
|
| 108 |
# A list of command names which should always be wrapped |
| 109 |
always_wrap = ['install'] |
| 110 |
|
| 111 |
# If true, the argument lists which are known to be sortable will be sorted |
| 112 |
# lexicographicall |
| 113 |
enable_sort = True |
| 114 |
|
| 115 |
# If true, the parsers may infer whether or not an argument list is sortable |
| 116 |
# (without annotation). |
| 117 |
autosort = False |
| 118 |
|
| 119 |
# By default, if cmake-format cannot successfully fit everything into the |
| 120 |
# desired linewidth it will apply the last, most agressive attempt that it |
| 121 |
# made. If this flag is True, however, cmake-format will print error, exit |
| 122 |
# with non-zero status code, and write-out nothing |
| 123 |
require_valid_layout = False |
| 124 |
|
| 125 |
# A dictionary mapping layout nodes to a list of wrap decisions. See the |
| 126 |
# documentation for more information. |
| 127 |
layout_passes = {} |
| 128 |
|
| 129 |
# ------------------------------------------------ |
| 130 |
# Options affecting comment reflow and formatting. |
| 131 |
# ------------------------------------------------ |
| 132 |
with section("markup"): |
| 133 |
|
| 134 |
# What character to use for bulleted lists |
| 135 |
bullet_char = '*' |
| 136 |
|
| 137 |
# What character to use as punctuation after numerals in an enumerated list |
| 138 |
enum_char = '.' |
| 139 |
|
| 140 |
# If comment markup is enabled, don't reflow the first comment block in each |
| 141 |
# listfile. Use this to preserve formatting of your copyright/license |
| 142 |
# statements. |
| 143 |
first_comment_is_literal = False |
| 144 |
|
| 145 |
# If comment markup is enabled, don't reflow any comment block which matches |
| 146 |
# this (regex) pattern. Default is `None` (disabled). |
| 147 |
literal_comment_pattern = None |
| 148 |
|
| 149 |
# Regular expression to match preformat fences in comments default= |
| 150 |
# ``r'^\s*([`~]{3}[`~]*)(.*)$'`` |
| 151 |
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' |
| 152 |
|
| 153 |
# Regular expression to match rulers in comments default= |
| 154 |
# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'`` |
| 155 |
ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' |
| 156 |
|
| 157 |
# If a comment line matches starts with this pattern then it is explicitly a |
| 158 |
# trailing comment for the preceeding argument. Default is '#<' |
| 159 |
explicit_trailing_pattern = '#<' |
| 160 |
|
| 161 |
# If a comment line starts with at least this many consecutive hash |
| 162 |
# characters, then don't lstrip() them off. This allows for lazy hash rulers |
| 163 |
# where the first hash char is not separated by space |
| 164 |
hashruler_min_length = 10 |
| 165 |
|
| 166 |
# If true, then insert a space between the first hash char and remaining hash |
| 167 |
# chars in a hash ruler, and normalize its length to fill the column |
| 168 |
canonicalize_hashrulers = True |
| 169 |
|
| 170 |
# enable comment markup parsing and reflow |
| 171 |
enable_markup = False |
| 172 |
|
| 173 |
# ---------------------------- |
| 174 |
# Options affecting the linter |
| 175 |
# ---------------------------- |
| 176 |
with section("lint"): |
| 177 |
|
| 178 |
# a list of lint codes to disable |
| 179 |
disabled_codes = ['C0307', 'C0301', 'C0305'] |
| 180 |
|
| 181 |
# regular expression pattern describing valid function names |
| 182 |
function_pattern = '[0-9a-z_]+' |
| 183 |
|
| 184 |
# regular expression pattern describing valid macro names |
| 185 |
macro_pattern = '[0-9A-Z_]+' |
| 186 |
|
| 187 |
# regular expression pattern describing valid names for variables with global |
| 188 |
# (cache) scope |
| 189 |
global_var_pattern = '[A-Z][0-9A-Z_]+' |
| 190 |
|
| 191 |
# regular expression pattern describing valid names for variables with global |
| 192 |
# scope (but internal semantic) |
| 193 |
internal_var_pattern = '_[A-Z][0-9A-Z_]+' |
| 194 |
|
| 195 |
# regular expression pattern describing valid names for variables with local |
| 196 |
# scope |
| 197 |
local_var_pattern = '[a-z][a-z0-9_]+' |
| 198 |
|
| 199 |
# regular expression pattern describing valid names for privatedirectory |
| 200 |
# variables |
| 201 |
private_var_pattern = '_[0-9a-z_]+' |
| 202 |
|
| 203 |
# regular expression pattern describing valid names for public directory |
| 204 |
# variables |
| 205 |
public_var_pattern = '[A-Z][0-9A-Z_]+' |
| 206 |
|
| 207 |
# regular expression pattern describing valid names for function/macro |
| 208 |
# arguments and loop variables. |
| 209 |
argument_var_pattern = '[a-z][a-z0-9_]+' |
| 210 |
|
| 211 |
# regular expression pattern describing valid names for keywords used in |
| 212 |
# functions or macros |
| 213 |
keyword_pattern = '[A-Z][0-9A-Z_]+' |
| 214 |
|
| 215 |
# In the heuristic for C0201, how many conditionals to match within a loop in |
| 216 |
# before considering the loop a parser. |
| 217 |
max_conditionals_custom_parser = 2 |
| 218 |
|
| 219 |
# Require at least this many newlines between statements |
| 220 |
min_statement_spacing = 1 |
| 221 |
|
| 222 |
# Require no more than this many newlines between statements |
| 223 |
max_statement_spacing = 2 |
| 224 |
max_returns = 6 |
| 225 |
max_branches = 12 |
| 226 |
max_arguments = 5 |
| 227 |
max_localvars = 15 |
| 228 |
max_statements = 50 |
| 229 |
|
| 230 |
# ------------------------------- |
| 231 |
# Options affecting file encoding |
| 232 |
# ------------------------------- |
| 233 |
with section("encode"): |
| 234 |
|
| 235 |
# If true, emit the unicode byte-order mark (BOM) at the start of the file |
| 236 |
emit_byteorder_mark = False |
| 237 |
|
| 238 |
# Specify the encoding of the input file. Defaults to utf-8 |
| 239 |
input_encoding = 'utf-8' |
| 240 |
|
| 241 |
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake |
| 242 |
# only claims to support utf-8 so be careful when using anything else |
| 243 |
output_encoding = 'utf-8' |
| 244 |
|
| 245 |
# ------------------------------------- |
| 246 |
# Miscellaneous configurations options. |
| 247 |
# ------------------------------------- |
| 248 |
with section("misc"): |
| 249 |
|
| 250 |
# A dictionary containing any per-command configuration overrides. Currently |
| 251 |
# only `command_case` is supported. |
| 252 |
per_command = {} |
| 253 |
|