File: format_cmake.sh

package info (click to toggle)
libcoap3 4.3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,368 kB
  • sloc: ansic: 60,037; makefile: 1,280; sh: 938; python: 6
file content (23 lines) | stat: -rwxr-xr-x 541 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

cmakeFormat="cmake-format"

path_to_cmake_format="$(which $cmakeFormat)"
echo "$path_to_cmake_format"

if [ -z "$cmakeFormat" ]
then
    echo "$cmakeFormat is not installed. Cannot format cmake files..."
    echo "run: pip install cmake-format"
    exit 1
fi

echo "$cmakeFormat was found, going to format your cmake scripts..." >&2

find $(dirname "$0")/ \
-not \( -path "*/build/*" -prune \) \
\( -name *.cmake -o -name CMakeLists.txt \) \
| xargs $cmakeFormat -c cmake-format.yaml -i


echo "done formatting with cmake-format"