diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-02-11 23:00:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-11 23:00:55 -0800 |
commit | 66f840939e81a6e240a01edfea61976363bc51d6 (patch) | |
tree | 024528c1e08d45ba39b6e32b76cf98ec2cb033fb /src/pal | |
parent | ce060415550334e598ee2efbc4beed0f07ede3f9 (diff) | |
download | coreclr-66f840939e81a6e240a01edfea61976363bc51d6.tar.gz coreclr-66f840939e81a6e240a01edfea61976363bc51d6.tar.bz2 coreclr-66f840939e81a6e240a01edfea61976363bc51d6.zip |
Improve CMake detection on Windows when not in PATH (#16328)
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)'`.
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/tools/probe-win.ps1 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pal/tools/probe-win.ps1 b/src/pal/tools/probe-win.ps1 index 3d6c969d06..fa30d9cb40 100644 --- a/src/pal/tools/probe-win.ps1 +++ b/src/pal/tools/probe-win.ps1 @@ -6,7 +6,7 @@ function GetCMakeVersions $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) @@ -17,7 +17,13 @@ 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 |