diff options
author | Brad King <brad.king@kitware.com> | 2021-05-12 19:51:47 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-13 16:47:25 (GMT) |
commit | 15fa3200715869d5acb94a282feb301d2e10a0eb (patch) | |
tree | 9c5d6c18b03b2917cc54d7fa2cfa5b9c89d8e4b0 /Source/cmGlobalNinjaGenerator.cxx | |
parent | 1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268 (diff) | |
download | CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.zip CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.gz CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.bz2 |
cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work
directories (e.g. top of the build tree) as the local path. Add helpers
for each of the common cases to simplify and clarify call sites.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 6937639..8cbc8e1 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1122,10 +1122,8 @@ std::string const& cmGlobalNinjaGenerator::ConvertToNinjaPath( return f->second; } - const auto& ng = - cm::static_reference_cast<cmLocalNinjaGenerator>(this->LocalGenerators[0]); - std::string const& bin_dir = ng.GetState()->GetBinaryDirectory(); - std::string convPath = ng.MaybeConvertToRelativePath(bin_dir, path); + std::string convPath = + this->LocalGenerators[0]->MaybeRelativeToTopBinDir(path); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 std::replace(convPath.begin(), convPath.end(), '/', '\\'); |