From 8112480921557ef7d290b3ff3038c22152539d53 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 22 Jun 2021 13:05:04 -0400 Subject: cmGeneratorTarget: Clarify ExpandLinkItems local variable role --- Source/cmGeneratorTarget.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 47975af..7933750 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -6399,19 +6399,22 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop, for (std::string const& lib : libs) { if (cm::optional maybeItem = this->LookupLinkItem(lib, cge->GetBacktrace(), &scope)) { - if (!maybeItem->Target) { + cmLinkItem item = std::move(*maybeItem); + + if (!item.Target) { // Report explicitly linked object files separately. - std::string const& maybeObj = maybeItem->AsStr(); + std::string const& maybeObj = item.AsStr(); if (cmSystemTools::FileIsFullPath(maybeObj)) { cmSourceFile const* sf = mf->GetSource(maybeObj, cmSourceFileLocationKind::Known); if (sf && sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { - iface.Objects.emplace_back(std::move(*maybeItem)); + iface.Objects.emplace_back(std::move(item)); continue; } } } - iface.Libraries.emplace_back(std::move(*maybeItem)); + + iface.Libraries.emplace_back(std::move(item)); } } iface.HadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition(); -- cgit v0.12