mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 04:09:33 -05:00
cmLocalGenerator: modernize memory management
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "cmExtraCodeBlocksGenerator.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
@@ -283,8 +284,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
|
||||
// add all executable and library targets and some of the GLOBAL
|
||||
// and UTILITY targets
|
||||
for (cmLocalGenerator* lg : lgs) {
|
||||
const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
|
||||
for (cmGeneratorTarget* target : targets) {
|
||||
const auto& targets = lg->GetGeneratorTargets();
|
||||
for (const auto& target : targets) {
|
||||
std::string targetName = target->GetName();
|
||||
switch (target->GetType()) {
|
||||
case cmStateEnums::GLOBAL_TARGET: {
|
||||
@@ -315,7 +316,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
|
||||
case cmStateEnums::SHARED_LIBRARY:
|
||||
case cmStateEnums::MODULE_LIBRARY:
|
||||
case cmStateEnums::OBJECT_LIBRARY: {
|
||||
cmGeneratorTarget* gt = target;
|
||||
cmGeneratorTarget* gt = target.get();
|
||||
this->AppendTarget(xml, targetName, gt, make, lg, compiler,
|
||||
makeArgs);
|
||||
std::string fastTarget = cmStrCat(targetName, "/fast");
|
||||
@@ -341,8 +342,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
|
||||
|
||||
for (cmLocalGenerator* lg : lgs) {
|
||||
cmMakefile* makefile = lg->GetMakefile();
|
||||
const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
|
||||
for (cmGeneratorTarget* target : targets) {
|
||||
const auto& targets = lg->GetGeneratorTargets();
|
||||
for (const auto& target : targets) {
|
||||
switch (target->GetType()) {
|
||||
case cmStateEnums::EXECUTABLE:
|
||||
case cmStateEnums::STATIC_LIBRARY:
|
||||
@@ -352,13 +353,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
|
||||
case cmStateEnums::UTILITY: // can have sources since 2.6.3
|
||||
{
|
||||
std::vector<cmSourceFile*> sources;
|
||||
cmGeneratorTarget* gt = target;
|
||||
gt->GetSourceFiles(sources,
|
||||
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
target->GetSourceFiles(
|
||||
sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for (cmSourceFile* s : sources) {
|
||||
// don't add source files from UTILITY target which have the
|
||||
// GENERATED property set:
|
||||
if (gt->GetType() == cmStateEnums::UTILITY &&
|
||||
if (target->GetType() == cmStateEnums::UTILITY &&
|
||||
s->GetIsGenerated()) {
|
||||
continue;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
|
||||
}
|
||||
|
||||
CbpUnit& cbpUnit = allFiles[fullPath];
|
||||
cbpUnit.Targets.push_back(target);
|
||||
cbpUnit.Targets.push_back(target.get());
|
||||
}
|
||||
}
|
||||
default: // intended fallthrough
|
||||
|
||||
Reference in New Issue
Block a user