1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-18 17:31:57 +08:00

Source: Minor optimizations

This commit is contained in:
AJIOB
2025-09-23 15:42:18 +03:00
committed by Brad King
parent 73fa6ab3e6
commit 2cae68ecbe
3 changed files with 7 additions and 7 deletions

View File

@@ -81,7 +81,7 @@ static void CreatePropertyGeneratorExpressions(
bool evaluateForBuildsystem = false) bool evaluateForBuildsystem = false)
{ {
for (auto const& entry : entries) { for (auto const& entry : entries) {
items.push_back(cmGeneratorTarget::TargetPropertyEntry::Create( items.emplace_back(cmGeneratorTarget::TargetPropertyEntry::Create(
cmakeInstance, entry, evaluateForBuildsystem)); cmakeInstance, entry, evaluateForBuildsystem));
} }
} }

View File

@@ -76,15 +76,15 @@ void processOptions(cmGeneratorTarget const* tgt,
options.emplace_back(opt, entry.Backtrace); options.emplace_back(opt, entry.Backtrace);
} }
if (debugOptions) { if (debugOptions) {
usedOptions += " * " + opt + "\n"; usedOptions += cmStrCat(" * ", opt, '\n');
} }
} }
} }
if (!usedOptions.empty()) { if (!usedOptions.empty()) {
tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
MessageType::LOG, MessageType::LOG,
std::string("Used ") + logName + std::string(" for target ") + cmStrCat("Used ", logName, " for target ", tgt->GetName(), ":\n",
tgt->GetName() + ":\n" + usedOptions, usedOptions),
entry.Backtrace); entry.Backtrace);
} }
} }
@@ -305,7 +305,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
{ {
std::vector<BT<std::string>> tmp = std::vector<BT<std::string>> tmp =
this->GetCompileDefinitions(config, language); this->GetCompileDefinitions(config, language);
result.reserve(tmp.size()); result.reserve(result.size() + tmp.size());
for (BT<std::string>& v : tmp) { for (BT<std::string>& v : tmp) {
result.emplace_back(std::move(v.Value)); result.emplace_back(std::move(v.Value));
} }

View File

@@ -62,7 +62,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag)
this->DoingDefine = true; this->DoingDefine = true;
} else { } else {
// Store this definition. // Store this definition.
this->Defines.push_back(flag.substr(2)); this->Defines.emplace_back(flag.substr(2));
} }
return; return;
} }
@@ -73,7 +73,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag)
this->DoingInclude = true; this->DoingInclude = true;
} else { } else {
// Store this include directory. // Store this include directory.
this->Includes.push_back(flag.substr(2)); this->Includes.emplace_back(flag.substr(2));
} }
return; return;
} }