cmGlobalNinjaGenerator: Add helper to compute absolute paths for build.ninja

This commit is contained in:
Brad King 2021-05-20 14:36:58 -04:00
parent efb8d7b4a1
commit 18408c0b88
3 changed files with 15 additions and 0 deletions

View File

@ -1160,6 +1160,15 @@ std::string const& cmGlobalNinjaGenerator::ConvertToNinjaPath(
.first->second;
}
std::string cmGlobalNinjaGenerator::ConvertToNinjaAbsPath(
std::string path) const
{
#ifdef _WIN32
std::replace(path.begin(), path.end(), '/', '\\');
#endif
return path;
}
void cmGlobalNinjaGenerator::AddAdditionalCleanFile(std::string fileName,
const std::string& config)
{

View File

@ -261,6 +261,7 @@ public:
}
std::string const& ConvertToNinjaPath(const std::string& path) const;
std::string ConvertToNinjaAbsPath(std::string path) const;
struct MapToNinjaPathImpl
{

View File

@ -110,6 +110,11 @@ protected:
return this->GetGlobalGenerator()->MapToNinjaPath();
}
std::string ConvertToNinjaAbsPath(std::string path) const
{
return this->GetGlobalGenerator()->ConvertToNinjaAbsPath(std::move(path));
}
/// @return the list of link dependency for the given target @a target.
cmNinjaDeps ComputeLinkDeps(const std::string& linkLanguage,
const std::string& config,