generators: use GetObjectOutputRoot to compute target directories

In a coming change to shorten directory paths, this allows one place to
decide how to compute the target path root.
This commit is contained in:
Ben Boeckel
2025-05-21 21:44:34 +02:00
parent b1d9a5313c
commit bc19e42461
3 changed files with 4 additions and 4 deletions

View File

@@ -972,8 +972,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
xml, "Build", make, buildArgs, virtDir, "", targetName.c_str());
std::string cleanArgs =
cmStrCat("-E chdir \"", lgen->GetCurrentBinaryDirectory(),
"\" \"", cmSystemTools::GetCMakeCommand(), "\" -P \"");
cmStrCat("-E chdir \"", lgen->GetObjectOutputRoot(), "\" \"",
cmSystemTools::GetCMakeCommand(), "\" -P \"");
cleanArgs += lgen->GetTargetDirectory(target.get());
cleanArgs += "/cmake_clean.cmake\"";
cmExtraEclipseCDT4Generator::AppendTarget(

View File

@@ -5218,7 +5218,7 @@ bool cmGeneratorTarget::NeedImportLibraryName(std::string const& config) const
std::string cmGeneratorTarget::GetSupportDirectory() const
{
cmLocalGenerator* lg = this->GetLocalGenerator();
return cmStrCat(lg->GetCurrentBinaryDirectory(), '/',
return cmStrCat(lg->GetObjectOutputRoot(), '/',
lg->GetTargetDirectory(this));
}

View File

@@ -75,7 +75,7 @@ void cmLocalNinjaGenerator::Generate()
// Compute the path to use when referencing the current output
// directory from the top output directory.
this->HomeRelativeOutputPath =
this->MaybeRelativeToTopBinDir(this->GetCurrentBinaryDirectory());
this->MaybeRelativeToTopBinDir(this->GetObjectOutputRoot());
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath.clear();
}