CMake code rely on cmList class for CMake lists management (part. 2)

This commit is contained in:
Marc Chevrier
2023-04-25 19:54:23 +02:00
parent 87fe031a07
commit 241304190f
60 changed files with 398 additions and 497 deletions
+12 -12
View File
@@ -610,7 +610,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
{
std::vector<std::string> linkCmds;
cmList linkCmds;
// this target requires separable cuda compilation
// now build the correct command depending on if the target is
@@ -619,23 +619,23 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
this->GetMakefile()->GetDefExpandList("CMAKE_CUDA_DEVICE_LINK_LIBRARY",
linkCmds);
linkCmds.assign(
this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY"));
} break;
case cmStateEnums::EXECUTABLE: {
this->GetMakefile()->GetDefExpandList(
"CMAKE_CUDA_DEVICE_LINK_EXECUTABLE", linkCmds);
linkCmds.assign(this->GetMakefile()->GetDefinition(
"CMAKE_CUDA_DEVICE_LINK_EXECUTABLE"));
} break;
default:
break;
}
return linkCmds;
return std::move(linkCmds.data());
}
std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
const std::string& config)
{
std::vector<std::string> linkCmds;
cmList linkCmds;
cmMakefile* mf = this->GetMakefile();
{
// If we have a rule variable prefer it. In the case of static libraries
@@ -654,7 +654,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
linkCmdStr += *rule;
}
}
cmExpandList(linkCmdStr, linkCmds);
linkCmds.assign(linkCmdStr);
if (this->UseLWYU) {
cmValue lwyuCheck = mf->GetDefinition("CMAKE_LINK_WHAT_YOU_USE_CHECK");
if (lwyuCheck) {
@@ -673,7 +673,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
linkCmds.push_back(std::move(cmakeCommand));
}
}
return linkCmds;
return std::move(linkCmds.data());
}
}
switch (this->GetGeneratorTarget()->GetType()) {
@@ -694,7 +694,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
linkCmdVar, this->TargetLinkLanguage(config), config);
std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmExpandList(linkCmd, linkCmds);
linkCmds.append(linkCmd);
}
{
std::string linkCmdVar = cmStrCat(
@@ -704,7 +704,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
linkCmdVar, this->TargetLinkLanguage(config), config);
std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmExpandList(linkCmd, linkCmds);
linkCmds.append(linkCmd);
}
#ifdef __APPLE__
// On macOS ranlib truncates the fractional part of the static archive
@@ -728,7 +728,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
default:
assert(false && "Unexpected target type");
}
return linkCmds;
return std::move(linkCmds.data());
}
void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(