Makefile: Improve const correctness
This commit is contained in:
parent
c2dd5dfbe8
commit
3e533bd64f
@ -139,7 +139,7 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
|
||||
this->LocalGenerator->AppendFlags(
|
||||
flags, this->GeneratorTarget->GetSafeProperty("LINK_FLAGS"));
|
||||
|
||||
std::string linkFlagsConfig =
|
||||
std::string const linkFlagsConfig =
|
||||
cmStrCat("LINK_FLAGS_", cmSystemTools::UpperCase(this->GetConfigName()));
|
||||
this->LocalGenerator->AppendFlags(
|
||||
flags, this->GeneratorTarget->GetSafeProperty(linkFlagsConfig));
|
||||
@ -236,7 +236,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
}
|
||||
|
||||
// Look for ISPC extra object files generated by this target
|
||||
auto ispcAdditionalObjs =
|
||||
auto const ispcAdditionalObjs =
|
||||
this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
|
||||
for (std::string const& ispcObj : ispcAdditionalObjs) {
|
||||
this->CleanFiles.insert(
|
||||
@ -244,7 +244,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
}
|
||||
|
||||
// add custom commands to the clean rules?
|
||||
bool clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
|
||||
bool const clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
|
||||
|
||||
// First generate the object rule files. Save a list of all object
|
||||
// files for this target.
|
||||
@ -1906,7 +1906,7 @@ void cmMakefileTargetGenerator::WriteObjectsStrings(
|
||||
for (std::string const& obj : this->ExternalObjects) {
|
||||
helper.Feed(obj);
|
||||
}
|
||||
auto ispcAdditionalObjs =
|
||||
auto const ispcAdditionalObjs =
|
||||
this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
|
||||
for (std::string const& obj : ispcAdditionalObjs) {
|
||||
helper.Feed(obj);
|
||||
@ -1970,7 +1970,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
|
||||
}
|
||||
|
||||
// Loop over all library dependencies.
|
||||
if (cmComputeLinkInformation* cli =
|
||||
if (cmComputeLinkInformation const* cli =
|
||||
this->GeneratorTarget->GetLinkInformation(cfg)) {
|
||||
cm::append(depends, cli->GetDepends());
|
||||
}
|
||||
@ -2195,9 +2195,10 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
|
||||
std::string responseFlag = this->GetResponseFlag(responseMode);
|
||||
|
||||
// Create this response file.
|
||||
std::string responseFileName =
|
||||
std::string const responseFileName =
|
||||
(responseMode == Link) ? "linkLibs.rsp" : "deviceLinkLibs.rsp";
|
||||
std::string responseLang = (responseMode == Link) ? linkLanguage : "CUDA";
|
||||
std::string const responseLang =
|
||||
(responseMode == Link) ? linkLanguage : "CUDA";
|
||||
std::string link_rsp = this->CreateResponseFile(
|
||||
responseFileName, linkLibs, makefile_depends, responseLang);
|
||||
|
||||
@ -2228,7 +2229,7 @@ void cmMakefileTargetGenerator::CreateObjectLists(
|
||||
responseFileLimit);
|
||||
|
||||
// Lookup the response file reference flag.
|
||||
std::string responseFlag = this->GetResponseFlag(responseMode);
|
||||
std::string const responseFlag = this->GetResponseFlag(responseMode);
|
||||
|
||||
// Write a response file for each string.
|
||||
const char* sep = "";
|
||||
@ -2268,15 +2269,15 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
||||
const std::string& lang,
|
||||
const std::string& /*config*/)
|
||||
{
|
||||
std::string responseVar =
|
||||
std::string const responseVar =
|
||||
cmStrCat("CMAKE_", lang, "_USE_RESPONSE_FILE_FOR_INCLUDES");
|
||||
bool useResponseFile = this->Makefile->IsOn(responseVar);
|
||||
bool const useResponseFile = this->Makefile->IsOn(responseVar);
|
||||
|
||||
std::vector<std::string> includes;
|
||||
this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
|
||||
lang, this->GetConfigName());
|
||||
|
||||
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
|
||||
std::string const includeFlags = this->LocalGenerator->GetIncludeFlags(
|
||||
includes, this->GeneratorTarget, lang, this->GetConfigName(),
|
||||
useResponseFile);
|
||||
if (includeFlags.empty()) {
|
||||
@ -2291,8 +2292,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
||||
if (responseFlag.empty()) {
|
||||
responseFlag = "@";
|
||||
}
|
||||
std::string name = cmStrCat("includes_", lang, ".rsp");
|
||||
std::string arg = std::move(responseFlag) +
|
||||
std::string const name = cmStrCat("includes_", lang, ".rsp");
|
||||
std::string const arg = std::move(responseFlag) +
|
||||
this->CreateResponseFile(name, includeFlags, this->FlagFileDepends[lang],
|
||||
lang);
|
||||
this->LocalGenerator->AppendFlags(flags, arg);
|
||||
@ -2321,7 +2322,7 @@ void cmMakefileTargetGenerator::GenDefFile(
|
||||
cmd += this->LocalGenerator->ConvertToOutputFormat(
|
||||
this->LocalGenerator->MaybeRelativeToCurBinDir(objlist_file),
|
||||
cmOutputConverter::SHELL);
|
||||
cmValue nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
|
||||
cmValue const nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
|
||||
if (cmNonempty(nm_executable)) {
|
||||
cmd += " --nm=";
|
||||
cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
|
||||
@ -2361,7 +2362,7 @@ std::string cmMakefileTargetGenerator::GetResponseFlag(
|
||||
responseFlagVar = "CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG";
|
||||
}
|
||||
|
||||
if (cmValue p = this->Makefile->GetDefinition(responseFlagVar)) {
|
||||
if (cmValue const p = this->Makefile->GetDefinition(responseFlagVar)) {
|
||||
responseFlag = *p;
|
||||
}
|
||||
return responseFlag;
|
||||
|
Loading…
Reference in New Issue
Block a user