1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 22:37:30 +08:00

cmake: Explicitly look up on-disk case of input paths on Windows

KWSys's `CollapseFullPath` no longer looks up the actual case on disk.
Add the lookup explicitly where we need it:

* `ToNormalizedPathOnDisk`
* `file(REAL_PATH)`
* `get_filename_component(... ABSOLUTE)`

Fixes: #20214
This commit is contained in:
Brad King
2024-10-23 09:10:15 -04:00
parent e9bd437a43
commit 773b75e4ed
3 changed files with 5 additions and 0 deletions

View File

@@ -1420,6 +1420,7 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
std::string oldPolicyPath =
cmSystemTools::CollapseFullPath(input, *arguments.BaseDirectory);
oldPolicyPath = cmSystemTools::GetRealPath(oldPolicyPath);
oldPolicyPath = cmSystemTools::GetActualCaseForPath(oldPolicyPath);
if (warnAbout152) {
computeNewPath(input, realPath);
if (oldPolicyPath != realPath) {

View File

@@ -113,6 +113,7 @@ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
// Resolve symlinks if possible
result = cmSystemTools::GetRealPath(result);
}
result = cmSystemTools::GetActualCaseForPath(result);
} else {
std::string err = "unknown component " + args[2];
status.SetError(err);

View File

@@ -1664,6 +1664,9 @@ std::string cmSystemTools::ToNormalizedPathOnDisk(std::string p)
{
p = cmSystemTools::CollapseFullPath(p);
cmSystemTools::ConvertToUnixSlashes(p);
#ifdef _WIN32
p = cmSystemTools::GetActualCaseForPathCached(p);
#endif
return p;
}