board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / support / dependencies / check-host-cmake.sh
blob9b63b0648d97b28bb243f2b83e25e0799d775c75
1 #!/bin/sh
3 candidate="${1}"
4 version_min="${2}"
6 major_min="${version_min%.*}"
7 minor_min="${version_min#*.}"
9 cmake=`which ${candidate}`
10 if [ ! -x "${cmake}" ]; then
11 # echo nothing: no suitable cmake found
12 exit 1
15 # Extract version X.Y from versions in the form X.Y or X.Y.Z
16 # with X, Y and Z numbers with one or more digits each, e.g.
17 # 3.2 -> 3.2
18 # 3.2.3 -> 3.2
19 # 3.2.42 -> 3.2
20 # 3.10 -> 3.10
21 # 3.10.4 -> 3.10
22 # 3.10.42 -> 3.10
23 version="$(${cmake} --version \
24 |sed -r -e '/.* ([[:digit:]]+\.[[:digit:]]+).*$/!d;' \
25 -e 's//\1/'
27 major="${version%.*}"
28 minor="${version#*.}"
30 if [ ${major} -gt ${major_min} ]; then
31 echo "${cmake}"
32 else
33 if [ ${major} -eq ${major_min} -a ${minor} -ge ${minor_min} ]; then
34 echo "${cmake}"
35 else
36 # echo nothing: no suitable cmake found
37 exit 1