diff --git a/.cmake-format.py b/.cmake-format.py
new file mode 100644
index 0000000000000000000000000000000000000000..9e09ed0174c9e1a7f53ac147e6f8b6897d936c43
--- /dev/null
+++ b/.cmake-format.py
@@ -0,0 +1,10 @@
+with section("format"):  # noqa: F821
+    dangle_parens = True
+    max_lines_hwrap = 0
+    keyword_case = "upper"
+    autosort = True
+
+with section("lint"):  # noqa: F821
+    # The formatter sometimes fails to fit the code into the line limit (C0301)
+    # and can disagree with the linter regarding the indentation (C0307):
+    disabled_codes = ["C0301", "C0307"]