Makefiles: populate the TARGET_SUPPORT_DIR replacement variable

This commit is contained in:
Ben Boeckel
2025-05-28 17:25:56 +02:00
parent dfba904178
commit dcba9ed828
4 changed files with 43 additions and 0 deletions

View File

@@ -1036,6 +1036,14 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
if (cmNonempty(val)) {
// Expand rule variables referenced in the given launcher command.
cmRulePlaceholderExpander::RuleVariables vars;
std::string targetSupportDir =
target->GetGlobalGenerator()->ConvertToOutputPath(
target->GetCMFSupportDirectory());
targetSupportDir = target->GetLocalGenerator()->ConvertToOutputFormat(
target->GetLocalGenerator()->MaybeRelativeToTopBinDir(
targetSupportDir),
cmOutputConverter::SHELL);
vars.TargetSupportDir = targetSupportDir.c_str();
vars.CMTargetName = target->GetName().c_str();
vars.CMTargetType =
cmState::GetTargetTypeName(target->GetType()).c_str();

View File

@@ -204,6 +204,12 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
objectDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir),
cmOutputConverter::SHELL);
std::string targetSupportDir =
this->GeneratorTarget->GetCMFSupportDirectory();
targetSupportDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToTopBinDir(targetSupportDir),
cmOutputConverter::SHELL);
std::string target = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput),
@@ -219,6 +225,7 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
vars.Objects = buildObjs.c_str();
vars.ObjectDir = objectDir.c_str();
vars.Target = target.c_str();
vars.TargetSupportDir = targetSupportDir.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.LanguageCompileFlags = langFlags.c_str();
vars.LinkFlags = linkFlags.c_str();
@@ -550,6 +557,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir),
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string targetSupportDir =
this->GeneratorTarget->GetCMFSupportDirectory();
targetSupportDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToTopBinDir(targetSupportDir),
cmOutputConverter::SHELL);
vars.TargetSupportDir = targetSupportDir.c_str();
std::string target = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(targetFullPathReal),
cmOutputConverter::SHELL, useWatcomQuote);

View File

@@ -364,6 +364,12 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir),
cmOutputConverter::SHELL);
std::string targetSupportDir =
this->GeneratorTarget->GetCMFSupportDirectory();
targetSupportDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToTopBinDir(targetSupportDir),
cmOutputConverter::SHELL);
std::string target = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput),
cmOutputConverter::SHELL);
@@ -376,6 +382,7 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
vars.Objects = buildObjs.c_str();
vars.ObjectDir = objectDir.c_str();
vars.TargetSupportDir = targetSupportDir.c_str();
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
@@ -798,6 +805,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string targetSupportDir =
this->GeneratorTarget->GetCMFSupportDirectory();
targetSupportDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToTopBinDir(targetSupportDir),
cmOutputConverter::SHELL);
vars.TargetSupportDir = targetSupportDir.c_str();
std::string target = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(targetFullPathReal),
cmOutputConverter::SHELL, useWatcomQuote);

View File

@@ -946,6 +946,12 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir),
cmOutputConverter::SHELL);
vars.ObjectDir = objectDir.c_str();
std::string targetSupportDir =
this->GeneratorTarget->GetCMFSupportDirectory();
targetSupportDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToTopBinDir(targetSupportDir),
cmOutputConverter::SHELL);
vars.TargetSupportDir = targetSupportDir.c_str();
std::string objectFileDir = cmSystemTools::GetFilenamePath(obj);
objectFileDir = this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(objectFileDir),