summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetLinkLibrariesCommand.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-01-12 15:58:54 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-01-14 10:03:07 (GMT)
commitf466cea3c9edffb1f524b64c514f8b7ef3913988 (patch)
treed6623a9efbd040dd7e6a091117fd642bc003b81c /Source/cmTargetLinkLibrariesCommand.cxx
parent2d5e9f3d8cf44fafcd9a3b75ebce3d6fe383fe4e (diff)
downloadCMake-f466cea3c9edffb1f524b64c514f8b7ef3913988.zip
CMake-f466cea3c9edffb1f524b64c514f8b7ef3913988.tar.gz
CMake-f466cea3c9edffb1f524b64c514f8b7ef3913988.tar.bz2
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 ad59748..1d9ecc2 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;
}
}