diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-26 19:45:37 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2024-01-05 10:06:33 (GMT) |
commit | 4a9613ff9b8c8b4e20c1fe1423b31d815b84aa94 (patch) | |
tree | 6c0bde6478535138f046b2b2d06b0e5f73b21b9b /Source | |
parent | 159872ab8bbb06f671ea3d976e8cd3f2e350bd55 (diff) | |
download | CMake-4a9613ff9b8c8b4e20c1fe1423b31d815b84aa94.zip CMake-4a9613ff9b8c8b4e20c1fe1423b31d815b84aa94.tar.gz CMake-4a9613ff9b8c8b4e20c1fe1423b31d815b84aa94.tar.bz2 |
cmNinjaTargetGenerator: add a method to compute the object directory
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.h | 1 |
2 files changed, 14 insertions, 15 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 7ea479e..1f7aaaf 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -411,28 +411,29 @@ std::string cmNinjaTargetGenerator::GetCompiledSourceNinjaPath( return this->ConvertToNinjaAbsPath(source->GetFullPath()); } -std::string cmNinjaTargetGenerator::GetObjectFilePath( - cmSourceFile const* source, const std::string& config) const +std::string cmNinjaTargetGenerator::GetObjectFileDir( + const std::string& config) const { std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); if (!path.empty()) { path += '/'; } - std::string const& objectName = this->GeneratorTarget->GetObjectName(source); - path += cmStrCat( - this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), - this->GetGlobalGenerator()->ConfigDirectory(config), '/', objectName); + path += + cmStrCat(this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), + this->GetGlobalGenerator()->ConfigDirectory(config)); return path; } -std::string cmNinjaTargetGenerator::GetBmiFilePath( +std::string cmNinjaTargetGenerator::GetObjectFilePath( cmSourceFile const* source, const std::string& config) const { - std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); - if (!path.empty()) { - path += '/'; - } + std::string const& objectName = this->GeneratorTarget->GetObjectName(source); + return cmStrCat(this->GetObjectFileDir(config), '/', objectName); +} +std::string cmNinjaTargetGenerator::GetBmiFilePath( + cmSourceFile const* source, const std::string& config) const +{ auto& importedConfigInfo = this->Configs.at(config).ImportedCxxModules; if (!importedConfigInfo.Initialized()) { std::string configUpper = cmSystemTools::UpperCase(config); @@ -444,10 +445,7 @@ std::string cmNinjaTargetGenerator::GetBmiFilePath( std::string bmiName = importedConfigInfo.BmiNameForSource(source->GetFullPath()); - path += cmStrCat( - this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), - this->GetGlobalGenerator()->ConfigDirectory(config), '/', bmiName); - return path; + return cmStrCat(this->GetObjectFileDir(config), '/', bmiName); } std::string cmNinjaTargetGenerator::GetClangTidyReplacementsFilePath( diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index b55c460..32d324e 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -128,6 +128,7 @@ protected: /// @return the source file path for the given @a source. std::string GetCompiledSourceNinjaPath(cmSourceFile const* source) const; + std::string GetObjectFileDir(const std::string& config) const; /// @return the object file path for the given @a source. std::string GetObjectFilePath(cmSourceFile const* source, const std::string& config) const; |