style: adapt clang-format
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..955f6ad
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,13 @@
+---
+BasedOnStyle: Chromium
+IndentWidth: 4
+TabWidth: 4
+UseTab: Always
+DerivePointerAlignment: true
+BreakBeforeBraces: Custom
+BraceWrapping:
+  AfterFunction: true
+  BeforeCatch: false
+  BeforeElse: false
+AlignAfterOpenBracket: false
+SortIncludes: false
\ No newline at end of file
diff --git a/README.md b/README.md
index 2bfbb55..7aac786 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
 
 Go ahead, file issues, make pull requests.
 
-before committing changes, run `./scripts/format_code.sh`
+before committing changes, run `./scripts/format_cmake.sh` and `./scripts/format_source.sh`
 
 ## Building
 
diff --git a/scripts/format_cmake.sh b/scripts/format_cmake.sh
new file mode 100755
index 0000000..a867199
--- /dev/null
+++ b/scripts/format_cmake.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+#  This script searches all source code files and formats them according to the .cmake-format style.
+
+cmakeFormat="cmake-format"
+
+if [ -z "$cmakeFormat" ]
+then
+    echo "$cmakeFormat is not installed. Cannot format cmake files..."
+    echo "run: pip3 install cmake-format"
+    exit 1
+fi
+
+SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
+PROJECT_PATH=$SCRIPTPATH/../
+PROJECT_PATH="$( cd "$PROJECT_PATH" >/dev/null 2>&1 ; pwd -P )"
+
+echo "$cmakeFormat was found, going to format your cmake scripts..." >&2
+echo "formatting from root folder: $PROJECT_PATH" >&2
+
+find "$PROJECT_PATH" \
+-not \( -path "*/build/*" -prune \) \
+-not \( -path "*/scripts/*" -prune \) \
+-not \( -path "*/.vscode/*" -prune \) \
+-not \( -path '*/cmake/LCov.cmake' -prune \) \
+-not \( -path '*/cmake/Coveralls.cmake' -prune \) \
+-not \( -path '*/cmake/CoverallsGenerateGcov.cmake' -prune \) \
+-not \( -path '*/cmake/CoverallsClear.cmake' -prune \) \
+-not \( -path '*/cmake/FindMbedTLS.cmake' -prune \) \
+\( -name *.cmake -o -name CMakeLists.txt ! -iname "*Find*" \) \
+| xargs $cmakeFormat -c cmake-format.yaml -i
+
+
+echo "done formatting with cmake-format"
diff --git a/scripts/format_source.sh b/scripts/format_source.sh
new file mode 100755
index 0000000..ba53d79
--- /dev/null
+++ b/scripts/format_source.sh
@@ -0,0 +1,44 @@
+#  This script searches all source code files and formats them according to the .clang-format style.
+
+base=clang-format
+format=""
+
+# Redirect output to stderr.
+exec 1>&2
+
+# check if clang-format is installed
+type "$base" >/dev/null 2>&1 && format="$base"
+ 
+path_to_clang_format="$(which $format)"
+echo "$path_to_clang_format"
+
+# no versions of clang-format are installed
+if [ -z "$format" ]
+then
+    echo "$base is not installed. Cannot format code..."
+    echo "run: pip3 install clang-format"
+    exit 1
+fi
+
+echo "$format was found, going to format your code..." >&2
+
+SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
+PROJECT_PATH=$SCRIPTPATH/../
+PROJECT_PATH="$( cd "$PROJECT_PATH" >/dev/null 2>&1 ; pwd -P )"
+
+echo "Project path: $PROJECT_PATH"
+
+find "$PROJECT_PATH" \
+-not \( -path "*/build/*" -prune \) \
+-not \( -path "*/_build/*" -prune \) \
+-not \( -path "*/cmake/*" -prune \) \
+-not \( -path "*/.vscode/*" -prune \) \
+-not \( -path "*/.idea/*" -prune \) \
+-not \( -path "*/third_party/*" -prune \) \
+-not \( -path "*Coverity_Model.c*" -prune \) \
+-not \( -path "*/docs/*" -prune \) \
+\( -name "*.h" -o -name "*.hpp" -o -name "*.c" -o -name "*.cpp" \) \
+| xargs $format -i
+
+
+echo "done formatting with clang"
\ No newline at end of file