-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck-requirements.sh
More file actions
executable file
·44 lines (36 loc) · 1.29 KB
/
check-requirements.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
requirements=(wget unzip cmake git make)
for requirement in ${requirements[@]} ; do
if ! type "${requirement}" > /dev/null 2>&1; then
echo "Requirement '${requirement}' not found!"
exit 1
fi
done
bad_cmake_version(){
echo "Minimum required CMake version is ${REQUIRED_CMAKE_MAJOR}.${REQUIRED_CMAKE_MINOR}.${REQUIRED_CMAKE_PATCH}"
echo "You only have ${CMAKE_VERSION}"
echo "Please upgrade your CMake"
exit 1
}
readonly REQUIRED_CMAKE_MAJOR=3
readonly REQUIRED_CMAKE_MINOR=7
readonly REQUIRED_CMAKE_PATCH=2
readonly CMAKE_VERSION=$(cmake --version | head -n 1 | sed 's/cmake version //g')
readonly CMAKE_MAJOR=$(echo ${CMAKE_VERSION} | sed -r 's/^([0-9]+).*$/\1/')
readonly CMAKE_MINOR=$(echo ${CMAKE_VERSION} | sed -r 's/^[0-9]+\.([0-9]+).*$/\1/')
readonly CMAKE_PATCH=$(echo ${CMAKE_VERSION} | sed -r 's/^[0-9]+\.[0-9]+\.([0-9]+).*$/\1/')
if (( ${CMAKE_MAJOR} < ${REQUIRED_CMAKE_MAJOR} )) ; then
bad_cmake_version
elif (( ${CMAKE_MAJOR} > ${REQUIRED_CMAKE_MAJOR} )) ; then
exit 0
fi
if (( ${CMAKE_MINOR} < ${REQUIRED_CMAKE_MINOR} )) ; then
bad_cmake_version
elif (( ${CMAKE_MINOR} > ${REQUIRED_CMAKE_MINOR} )) ; then
exit 0
fi
if (( ${CMAKE_PATCH} < ${REQUIRED_CMAKE_PATCH} )) ; then
bad_cmake_version
else
exit 0
fi