summaryrefslogtreecommitdiff
path: root/Source/cmTargetLinkLibrariesCommand.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-01-12 16:58:54 +0100
committerMarc Chevrier <marc.chevrier@gmail.com>2020-01-14 11:03:07 +0100
commitf466cea3c9edffb1f524b64c514f8b7ef3913988 (patch)
treed6623a9efbd040dd7e6a091117fd642bc003b81c /Source/cmTargetLinkLibrariesCommand.cxx
parent2d5e9f3d8cf44fafcd9a3b75ebce3d6fe383fe4e (diff)
downloadcmake-f466cea3c9edffb1f524b64c514f8b7ef3913988.tar.gz
cmMakefile: modernize memory management
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index ad59748d29..1d9ecc2618 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -3,6 +3,7 @@
#include "cmTargetLinkLibrariesCommand.h"
#include <cstring>
+#include <memory>
#include <sstream>
#include "cmExecutionStatus.h"
@@ -64,11 +65,9 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
cmTarget* target =
mf.GetCMakeInstance()->GetGlobalGenerator()->FindTarget(args[0]);
if (!target) {
- const std::vector<cmTarget*>& importedTargets =
- mf.GetOwnedImportedTargets();
- for (cmTarget* importedTarget : importedTargets) {
+ for (const auto& importedTarget : mf.GetOwnedImportedTargets()) {
if (importedTarget->GetName() == args[0]) {
- target = importedTarget;
+ target = importedTarget.get();
break;
}
}