diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 964debf0f6..9cb8d906f0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1420,6 +1420,7 @@ bool HandleRealPathCommand(std::vector 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) { diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 1815c4d1c4..6ca5930958 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -113,6 +113,7 @@ bool cmGetFilenameComponentCommand(std::vector 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); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 856da77fea..dcd90bcb18 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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; }