cmGlobalXCodeGenerator: Re-implement legacy makefile path escaping

Apply commit d74e651b78 (Makefiles: Re-implement makefile target path
escaping and quoting, 2020-04-10, v3.18.0-rc1~334^2~1) to the Xcode
generator's legacy Makefile generation.  This adds support for '#'.
However, since we use '$(VAR)' placeholders, do not escape '$'.

Issue: #25604
This commit is contained in:
Brad King
2024-05-15 10:29:02 -04:00
parent d929089687
commit b38000d774

View File

@@ -267,7 +267,21 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
namespace {
std::string ConvertToMakefilePath(std::string const& path)
{
return cmSystemTools::ConvertToOutputPath(path);
std::string result;
result.reserve(path.size());
for (char c : path) {
switch (c) {
case '\\':
case ' ':
case '#':
result.push_back('\\');
CM_FALLTHROUGH;
default:
result.push_back(c);
break;
}
}
return result;
}
}