Skip to content

Commit 336d43c

Browse files
committed
FDS Build: Add CMake version check for Windows
1 parent 8daafb0 commit 336d43c

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Build/Scripts/HYPRE/build_hypre.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ 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+
2331
set CURDIR=%CD%
2432

2533
::*** define root directory where fds repo and libs directories are located
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
set REQUIRED_MAJOR=3
5+
set REQUIRED_MINOR=21
6+
7+
:: Check if cmake is installed
8+
where cmake >nul 2>nul
9+
if errorlevel 1 (
10+
echo Error: CMake is not installed. Please install CMake version 3.21.0 or newer.
11+
exit /b 1
12+
)
13+
14+
:: Get installed cmake version
15+
for /f "tokens=3" %%v in ('cmake --version') do (
16+
set VERSION=%%v
17+
goto :parse_version
18+
)
19+
20+
:parse_version
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 version
28+
if !MAJOR! LSS %REQUIRED_MAJOR% (
29+
echo Error: Installed CMake version is !VERSION!. Version 3.21.0 or newer is required.
30+
exit /b 1
31+
)
32+
33+
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+
exit /b 1
36+
)
37+
38+
echo CMake version !VERSION! is sufficient.
39+
exit /b 0

0 commit comments

Comments
 (0)