-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_cmake.ps1
29 lines (22 loc) · 1.05 KB
/
install_cmake.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$cmakeVersion = "3.21.2"
$cmakeUninstallPath = "${env:ProgramFiles}\CMake\Uninstall.exe"
if([IO.File]::Exists($cmakeUninstallPath)) {
Write-Host "Uninstalling previous CMake ..." -ForegroundColor Cyan
# uninstall existent
"`"$cmakeUninstallPath`" /S" | out-file ".\uninstall-cmake.cmd" -Encoding ASCII
& .\uninstall-cmake.cmd
Remove-Item .\uninstall-cmake.cmd
Start-Sleep -s 10
}
Write-Host "Installing CMake $cmakeVersion ..." -ForegroundColor Cyan
$msiPath = "$env:TEMP\cmake-$cmakeVersion-windows-i386.msi"
Write-Host "Downloading..."
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object Net.WebClient).DownloadFile("https://github.com/Kitware/CMake/releases/download/v$cmakeVersion/cmake-$cmakeVersion-windows-i386.msi", $msiPath)
Write-Host "Installing..."
cmd /c start /wait msiexec /i $msiPath /quiet
Remove-Item $msiPath
Add-Path "${env:ProgramFiles}\CMake\bin"
remove-path 'C:\ProgramData\chocolatey\bin'
add-path 'C:\ProgramData\chocolatey\bin'
Write-Host "CMake installed" -ForegroundColor Green