Skip to content

Commit 346bd22

Browse files
PaulPaul
authored andcommitted
FDS Build: Correction with CMake version check for Windows.
1 parent 336d43c commit 346bd22

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

Build/Scripts/HYPRE/build_hypre.bat

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ call :is_file_installed cmake || set abort=1
2020
call :is_file_installed make || set abort=1
2121
if %abort% == 1 exit /b
2222

23-
echo Running CMake version check...
24-
call ../check_cmake_version.bat
25-
if errorlevel 1 (
26-
echo Exiting due to CMake version error.
27-
exit /b 1
28-
)
29-
echo Proceeding with build...
30-
3123
set CURDIR=%CD%
3224

3325
::*** define root directory where fds repo and libs directories are located
@@ -84,6 +76,15 @@ echo ----------------------------------------------------------
8476
echo ----------------------------------------------------------
8577
echo.
8678

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+
8788
echo.
8889
echo ----------------------------------------------------------
8990
echo ----------------------------------------------------------

Build/Scripts/check_cmake_version.bat

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,36 @@ setlocal enabledelayedexpansion
33

44
set REQUIRED_MAJOR=3
55
set REQUIRED_MINOR=21
6+
set VERSION_STRING=%REQUIRED_MAJOR%.%REQUIRED_MINOR%.0
67

78
:: Check if cmake is installed
89
where cmake >nul 2>nul
910
if errorlevel 1 (
10-
echo Error: CMake is not installed. Please install CMake version 3.21.0 or newer.
11+
echo Error: CMake is not installed. Please install CMake version %VERSION_STRING% or newer.
1112
exit /b 1
1213
)
1314

14-
:: Get installed cmake version
15-
for /f "tokens=3" %%v in ('cmake --version') do (
15+
:: Extract the version number
16+
for /f "tokens=3" %%v in ('cmake --version ^| findstr /i "version"') do (
1617
set VERSION=%%v
17-
goto :parse_version
1818
)
1919

20-
:parse_version
20+
:: Parse version into major, minor, patch
2121
for /f "tokens=1,2,3 delims=." %%a in ("!VERSION!") do (
2222
set MAJOR=%%a
2323
set MINOR=%%b
2424
set PATCH=%%c
2525
)
2626

27-
:: Compare version
27+
:: Compare major version
2828
if !MAJOR! LSS %REQUIRED_MAJOR% (
29-
echo Error: Installed CMake version is !VERSION!. Version 3.21.0 or newer is required.
29+
echo Error: Installed CMake version is !VERSION!. Version %VERSION_STRING% or newer is required.
3030
exit /b 1
3131
)
3232

33+
:: Compare minor version if major matches
3334
if !MAJOR! EQU %REQUIRED_MAJOR% if !MINOR! LSS %REQUIRED_MINOR% (
34-
echo Error: Installed CMake version is !VERSION!. Version 3.21.0 or newer is required.
35+
echo Error: Installed CMake version is !VERSION!. Version %VERSION_STRING% or newer is required.
3536
exit /b 1
3637
)
3738

0 commit comments

Comments
 (0)