style: add format script for cmake
diff --git a/README.md b/README.md
index f7b3912..db6bc80 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,8 @@
 
 Go ahead, file issues, make pull requests.
 
+before committing changes, run `./scripts/format_code.sh`
+
 ## Building
 
 The project is setup to build using *CMake.*  The way that the CMake files are setup, it requires that version 3.0 or higher is used.
diff --git a/cmake-format.yaml b/cmake-format.yaml
index 60329ed..8086dd4 100644
--- a/cmake-format.yaml
+++ b/cmake-format.yaml
@@ -1,5 +1,10 @@
 # https://github.com/cheshirekow/cmake_format
 
+# usage:
+
+# pip install cmake_format --upgrade
+# ./scripts/format_cmake.sh
+
 # How wide to allow formatted cmake files
 line_width: 120
 
diff --git a/scripts/format_code.sh b/scripts/format_code.sh
new file mode 100755
index 0000000..a867199
--- /dev/null
+++ b/scripts/format_code.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"