Skip to content

Commit 12b2ac8

Browse files
committed
refactor(): use choco for cmake
Install cmake through chocolatey.
1 parent 4730b9d commit 12b2ac8

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

WebKitDev/Functions/Install-CMake.ps1

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,15 @@ function Install-CMake {
2828
[string]$installationPath
2929
)
3030

31-
$major,$minor,$patch = $version.split('.');
32-
33-
# CMake releases moved to GitHub in 3.20
34-
if (([int]$major -ge 4) -or (([int]$major -eq 3) -and ([int]$minor -ge 20))) {
35-
$url = ('https://github.com/Kitware/CMake/releases/download/v{0}/cmake-{0}-windows-x86_64.msi' -f $version)
36-
}
37-
else {
38-
$url = ('https://cmake.org/files/v{0}.{1}/cmake-{2}-win64_x64.msi' -f $major,$minor,$version);
39-
}
40-
41-
$options = @(
42-
'ADD_CMAKE_TO_PATH="System"'
43-
);
31+
$installerOptions = @('ADD_CMAKE_TO_PATH=System');
4432

4533
if ($installationPath) {
46-
$options += ('INSTALL_ROOT="{0}"' -f $installationPath);
34+
$installerOptions += ('INSTALL_ROOT="{0}"' -f $installationPath);
4735
}
4836

49-
Install-FromMsi -Name 'cmake' -url $url -Options $options;
37+
Install-FromChoco `
38+
-Name 'cmake' `
39+
-Version $version `
40+
-Options @('--apply-install-arguments-to-dependencies') `
41+
-InstallerOptions $installerOptions;
5042
}

0 commit comments

Comments
 (0)