summaryrefslogtreecommitdiff
path: root/scripts/buildtests.sh
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2021-02-06 08:45:33 -0500
committerAllen Winter <allen.winter@kdab.com>2021-02-06 08:45:33 -0500
commitaa35c4504596eee6924f6b4ff92ca304ded491db (patch)
treec0e0fee312297bbbc5b5585c61c621048ad1a64a /scripts/buildtests.sh
parent6be7675efe7f9ecacc964f3b37a27cde19490f55 (diff)
downloadlibical-git-aa35c4504596eee6924f6b4ff92ca304ded491db.tar.gz
scripts/buildtests.sh - improve CMake version calculation
Diffstat (limited to 'scripts/buildtests.sh')
-rwxr-xr-xscripts/buildtests.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/buildtests.sh b/scripts/buildtests.sh
index 3167779a..dff3bcdb 100755
--- a/scripts/buildtests.sh
+++ b/scripts/buildtests.sh
@@ -528,6 +528,18 @@ then
# read the min required CMake version from the top-level CMake file
minCMakeVers=`grep -i cmake_minimum_required $TOP/CMakeLists.txt | grep VERSION | sed 's/^.*VERSION\s*//i' | cut -d. -f1-2 | sed 's/\s*).*$//'`
# adjust PATH
+ X=`echo $minCMakeVers | cut -d. -f1`
+ Y=`echo $minCMakeVers | cut -d. -f2`
+ if ( test -z $X -o -z $Y )
+ then
+ echo "Bad CMake version encountered in the $TOP/CMakeLists.txt"
+ exit 1
+ fi
+ Z=`echo $minCMakeVers | cut -d. -f3`
+ if ( test -z $Z )
+ then
+ minCMakeVers="$minCMakeVers.0"
+ fi
export PATH=/usr/local/opt/cmake-$minCMakeVers/bin:$PATH
# check the version
if ( test `cmake --version | head -1 | grep -c $minCMakeVers` -ne 1 )