diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-12 15:58:54 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-01-14 10:03:07 (GMT) |
commit | f466cea3c9edffb1f524b64c514f8b7ef3913988 (patch) | |
tree | d6623a9efbd040dd7e6a091117fd642bc003b81c /Source/cmTarget.cxx | |
parent | 2d5e9f3d8cf44fafcd9a3b75ebce3d6fe383fe4e (diff) | |
download | CMake-f466cea3c9edffb1f524b64c514f8b7ef3913988.zip CMake-f466cea3c9edffb1f524b64c514f8b7ef3913988.tar.gz CMake-f466cea3c9edffb1f524b64c514f8b7ef3913988.tar.bz2 |
cmMakefile: modernize memory management
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9563321..6590629 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1562,8 +1562,12 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value, static void cmTargetCheckIMPORTED_GLOBAL(const cmTarget* target, cmMakefile* context) { - std::vector<cmTarget*> targets = context->GetOwnedImportedTargets(); - auto it = std::find(targets.begin(), targets.end(), target); + const auto& targets = context->GetOwnedImportedTargets(); + auto it = + std::find_if(targets.begin(), targets.end(), + [&](const std::unique_ptr<cmTarget>& importTarget) -> bool { + return target == importTarget.get(); + }); if (it == targets.end()) { std::ostringstream e; e << "Attempt to promote imported target \"" << target->GetName() |