Port dotnet/corert#5372
curl https://github.com/dotnet/corert/commit/
b723f90c611a2c79a0921f95c7299ebb7325eb59.patch | git am -p 3 --directory='src/pal/tools/' --reject
In CMake v10.2, the key `hklm:\SOFTWARE\Kitware` returns:
```powershell
Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Kitware
Name Property
---- --------
CMake InstallDir : C:\Program Files\CMake\
```
with no space after `CMake` and property name `InstallDir`,
instead of `'(default)'`.
$items = @()
$items += @(Get-ChildItem hklm:\SOFTWARE\Wow6432Node\Kitware -ErrorAction SilentlyContinue)
$items += @(Get-ChildItem hklm:\SOFTWARE\Kitware -ErrorAction SilentlyContinue)
- return $items | where { $_.PSChildName.StartsWith("CMake ") }
+ return $items | where { $_.PSChildName.StartsWith("CMake") }
}
function GetCMakeInfo($regKey)
catch {
return $null
}
- $cmakeDir = (Get-ItemProperty $regKey.PSPath).'(default)'
+ $itemProperty = Get-ItemProperty $regKey.PSPath;
+ if (Get-Member -inputobject $itemProperty -name "InstallDir" -Membertype Properties) {
+ $cmakeDir = $itemProperty.InstallDir
+ }
+ else {
+ $cmakeDir = $itemProperty.'(default)'
+ }
$cmakePath = [System.IO.Path]::Combine($cmakeDir, "bin\cmake.exe")
if (![System.IO.File]::Exists($cmakePath)) {
return $null