-
Notifications
You must be signed in to change notification settings - Fork 71
/
install_cmake.ps1
29 lines (22 loc) · 1.04 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.13.3"
$cmakeUninstallPath = "${env:ProgramFiles(x86)}\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
del .\uninstall-cmake.cmd
Start-Sleep -s 10
}
Write-Host "Installing CMake $cmakeVersion ..." -ForegroundColor Cyan
$msiPath = "$env:TEMP\cmake-$cmakeVersion-win32-x86.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-win32-x86.msi", $msiPath)
Write-Host "Installing..."
cmd /c start /wait msiexec /i $msiPath /quiet
del $msiPath
Add-Path 'C:\Program Files (x86)\CMake\bin'
remove-path 'C:\ProgramData\chocolatey\bin'
add-path 'C:\ProgramData\chocolatey\bin'
Write-Host "CMake installed" -ForegroundColor Green