File tree Expand file tree Collapse file tree 4 files changed +79
-0
lines changed
Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,15 @@ echo ----------------------------------------------------------
7676echo ----------------------------------------------------------
7777echo .
7878
79+ echo Running CMake version check...
80+ call %CURDIR% /../check_cmake_version.bat
81+ if errorlevel 1 (
82+ echo Exiting due to CMake version error.
83+ pause
84+ exit /b 1
85+ )
86+ echo Proceeding with build...
87+
7988echo .
8089echo ----------------------------------------------------------
8190echo ----------------------------------------------------------
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ echo "Checking for hypre repository..."
3131
3232if [ -d " $FIREMODELS /hypre" ]; then
3333 echo " Hypre repository exists. Building hypre library."
34+
35+ # Check CMake version.
36+ source ../Scripts/check_cmake_version.sh
37+
3438 cd $FIREMODELS /hypre
3539 # Handle possible corrupted state of repository
3640 if git branch | grep -q " * master" ; then
Original file line number Diff line number Diff line change 1+ @ echo off
2+ setlocal enabledelayedexpansion
3+
4+ set REQUIRED_MAJOR = 3
5+ set REQUIRED_MINOR = 21
6+ set VERSION_STRING = %REQUIRED_MAJOR% .%REQUIRED_MINOR% .0
7+
8+ :: Check if cmake is installed
9+ where cmake > nul 2 > nul
10+ if errorlevel 1 (
11+ echo Error: CMake is not installed. Please install CMake version %VERSION_STRING% or newer.
12+ exit /b 1
13+ )
14+
15+ :: Extract the version number
16+ for /f " tokens=3" %%v in ('cmake --version ^ | findstr /i " version" ') do (
17+ set VERSION = %%v
18+ )
19+
20+ :: Parse version into major, minor, patch
21+ for /f " tokens=1,2,3 delims=." %%a in (" !VERSION! " ) do (
22+ set MAJOR = %%a
23+ set MINOR = %%b
24+ set PATCH = %%c
25+ )
26+
27+ :: Compare major version
28+ if !MAJOR! LSS %REQUIRED_MAJOR% (
29+ echo Error: Installed CMake version is !VERSION! . Version %VERSION_STRING% or newer is required.
30+ exit /b 1
31+ )
32+
33+ :: Compare minor version if major matches
34+ if !MAJOR! EQU %REQUIRED_MAJOR% if !MINOR! LSS %REQUIRED_MINOR% (
35+ echo Error: Installed CMake version is !VERSION! . Version %VERSION_STRING% or newer is required.
36+ exit /b 1
37+ )
38+
39+ echo CMake version !VERSION! is sufficient.
40+ exit /b 0
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Required minimum version
4+ REQUIRED_VERSION=" 3.21.0"
5+
6+ # Function to compare versions
7+ version_ge () {
8+ [ " $( printf ' %s\n' " $2 " " $1 " | sort -V | head -n1) " = " $2 " ]
9+ }
10+
11+ # Check if cmake is installed
12+ if ! command -v cmake & > /dev/null; then
13+ echo " Error: CMake is not installed. Please install CMake version $REQUIRED_VERSION or newer."
14+ exit 1
15+ fi
16+
17+ # Get installed cmake version
18+ INSTALLED_VERSION=$( cmake --version | head -n1 | awk ' {print $3}' )
19+
20+ # Compare versions
21+ if version_ge " $INSTALLED_VERSION " " $REQUIRED_VERSION " ; then
22+ echo " CMake version $INSTALLED_VERSION is sufficient."
23+ else
24+ echo " Error: Installed CMake version is $INSTALLED_VERSION . Version $REQUIRED_VERSION or newer is required."
25+ exit 1
26+ fi
You can’t perform that action at this time.
0 commit comments