diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-11-07 17:52:06 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2019-11-11 15:41:13 (GMT) |
commit | f93385283fc86639c0a13b920c66c3a8f42276bb (patch) | |
tree | 7fa219d170720581d6d8438d0be6a1162e0c3b51 /Source/cmGlobalVisualStudio8Generator.cxx | |
parent | 101b5288ffa988b86fc1fe83f3ff65c9694b1484 (diff) | |
download | CMake-f93385283fc86639c0a13b920c66c3a8f42276bb.zip CMake-f93385283fc86639c0a13b920c66c3a8f42276bb.tar.gz CMake-f93385283fc86639c0a13b920c66c3a8f42276bb.tar.bz2 |
cmLocalGenerator: modernize memory management
Diffstat (limited to 'Source/cmGlobalVisualStudio8Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 8e6125b..d39d42a 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalVisualStudio8Generator.h" +#include <cm/memory> + #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" #include "cmDocumentationEntry.h" @@ -109,8 +111,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmCommandOrigin::Generator, false, no_working_directory, no_byproducts, no_depends, no_commands); - cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); - lg->AddGeneratorTarget(gt); + auto ptr = cm::make_unique<cmGeneratorTarget>(tgt, lg); + auto gt = ptr.get(); + lg->AddGeneratorTarget(std::move(ptr)); // Organize in the "predefined targets" folder: // @@ -203,10 +206,9 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets() cmGlobalVisualStudio7Generator::AddExtraIDETargets(); if (this->AddCheckTarget()) { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - const std::vector<cmGeneratorTarget*>& tgts = - this->LocalGenerators[i]->GetGeneratorTargets(); + const auto& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); // All targets depend on the build-system check target. - for (cmGeneratorTarget const* ti : tgts) { + for (const auto& ti : tgts) { if (ti->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { ti->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); } |