GetDefinition: avoid duplicate calls
This commit is contained in:
parent
1336d11d9c
commit
1e805f53f5
@ -921,11 +921,11 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
}
|
||||
}
|
||||
|
||||
if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
|
||||
if (auto d = mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
|
||||
if (!absoluteDestFiles.empty()) {
|
||||
absoluteDestFiles += ";";
|
||||
}
|
||||
absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
|
||||
absoluteDestFiles += d;
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||
"Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles
|
||||
<< std::endl);
|
||||
@ -936,8 +936,7 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
GetComponentInstallDirNameSuffix(component);
|
||||
if (nullptr != this->GetOption(absoluteDestFileComponent)) {
|
||||
std::string absoluteDestFilesListComponent =
|
||||
cmStrCat(this->GetOption(absoluteDestFileComponent), ';',
|
||||
mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
|
||||
cmStrCat(this->GetOption(absoluteDestFileComponent), ';', d);
|
||||
this->SetOption(absoluteDestFileComponent,
|
||||
absoluteDestFilesListComponent.c_str());
|
||||
} else {
|
||||
|
@ -113,8 +113,8 @@ bool cmForEachFunctionBlocker::ReplayItems(
|
||||
// At end of for each execute recorded commands
|
||||
// store the old value
|
||||
std::string oldDef;
|
||||
if (mf.GetDefinition(this->Args.front())) {
|
||||
oldDef = mf.GetDefinition(this->Args.front());
|
||||
if (auto d = mf.GetDefinition(this->Args.front())) {
|
||||
oldDef = d;
|
||||
}
|
||||
|
||||
auto restore = false;
|
||||
@ -186,8 +186,8 @@ bool cmForEachFunctionBlocker::ReplayZipLists(
|
||||
// Store old values for iteration variables
|
||||
std::map<std::string, std::string> oldDefs;
|
||||
for (auto i = 0u; i < values.size(); ++i) {
|
||||
if (mf.GetDefinition(iterationVars[i])) {
|
||||
oldDefs.emplace(iterationVars[i], mf.GetDefinition(iterationVars[i]));
|
||||
if (auto d = mf.GetDefinition(iterationVars[i])) {
|
||||
oldDefs.emplace(iterationVars[i], d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1027,8 +1027,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
|
||||
gt->GetFullNameComponents(prefix, base, suffix, config);
|
||||
std::string dbg_suffix = ".dbg";
|
||||
// TODO: Where to document?
|
||||
if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
|
||||
dbg_suffix = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX");
|
||||
if (auto d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
|
||||
dbg_suffix = d;
|
||||
}
|
||||
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
|
||||
}
|
||||
|
@ -749,9 +749,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
|
||||
if (!mf->GetIsSourceFileTryCompile()) {
|
||||
rule.DepType = "gcc";
|
||||
rule.DepFile = "$DEP_FILE";
|
||||
const std::string cl = mf->GetDefinition("CMAKE_C_COMPILER")
|
||||
? mf->GetSafeDefinition("CMAKE_C_COMPILER")
|
||||
: mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
|
||||
auto d = mf->GetDefinition("CMAKE_C_COMPILER");
|
||||
const std::string cl =
|
||||
d ? d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
|
||||
cldeps = cmStrCat('"', cmSystemTools::GetCMClDepsCommand(), "\" ", lang,
|
||||
' ', vars.Source, " $DEP_FILE $out \"",
|
||||
mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"),
|
||||
|
@ -84,8 +84,8 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
|
||||
std::string utilityDirectory =
|
||||
status.GetMakefile().GetCurrentBinaryDirectory();
|
||||
std::string exePath;
|
||||
if (status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
|
||||
exePath = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||
if (auto d = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
|
||||
exePath = d;
|
||||
}
|
||||
if (!exePath.empty()) {
|
||||
utilityDirectory = exePath;
|
||||
|
Loading…
Reference in New Issue
Block a user