Windows: Restore support for running CMake through a symlink

The change in commit v3.11.3~3^2 (cmSystemTools: Revert GetRealPath
implementation on Windows, 2018-05-29) broke the feature added by commit
v3.11.0-rc1~64^2 (Windows: Add support for running CMake tools through a
symlink, 2018-01-21).  Use `GetRealPathResolvingWindowsSubst` in the
latter code path to restore it.

Fixes: #17882
This commit is contained in:
Brad King
2018-06-12 11:02:28 -04:00
parent 8738eba336
commit 4e6ff0ae24

View File

@@ -2117,7 +2117,8 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
wchar_t modulepath[_MAX_PATH];
::GetModuleFileNameW(NULL, modulepath, sizeof(modulepath));
std::string path = cmsys::Encoding::ToNarrow(modulepath);
std::string realPath = cmSystemTools::GetRealPath(path, NULL);
std::string realPath =
cmSystemTools::GetRealPathResolvingWindowsSubst(path, NULL);
if (realPath.empty()) {
realPath = path;
}