diff --git a/.cmake-format.py b/.cmake-format.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1c41b5049c3d189575596f81a21c0f5adb8157b
--- /dev/null
+++ b/.cmake-format.py
@@ -0,0 +1,12 @@
+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"]
+    
+    private_var_pattern = "[A-Z][0-9a-zA-Z]+_[0-9A-Z_]+|_[0-9a-z_]"