summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-25 13:22:42 +0100
committerStephen Kelly <steveire@gmail.com>2015-10-27 07:44:26 +0100
commit79c3a2a8f72ea175533da9f323f88c507220486e (patch)
tree624bff47e0a7b47392b422a6f4920ccd65456674 /Source
parentc389f8bb07e900d805ca3163f47b06e3dbe4303b (diff)
downloadcmake-79c3a2a8f72ea175533da9f323f88c507220486e.tar.gz
cmGlobalGenerator: Remove map from cmTarget to cmGeneratorTarget
The configure-time and generate-time types should be completely independent. Add ownership of cmGeneratorTarget instances to the cmLocalGenerator.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx26
-rw-r--r--Source/cmGlobalGenerator.h14
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx7
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx1
8 files changed, 12 insertions, 42 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d53f0e3ecd..3d2db422f2 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1208,8 +1208,6 @@ void cmGlobalGenerator::Configure()
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
{
this->CreateLocalGenerators();
- cmDeleteAll(this->GeneratorTargets);
- this->GeneratorTargets.clear();
this->CreateGeneratorTargets(targetTypes);
this->ComputeBuildFileGenerators();
}
@@ -1597,7 +1595,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(
{
cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
- this->GeneratorTargets[t] = gt;
lg->AddGeneratorTarget(gt);
}
}
@@ -1622,9 +1619,9 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
j = mf->GetOwnedImportedTargets().begin();
j != mf->GetOwnedImportedTargets().end(); ++j)
{
- cmGeneratorTarget* gt =
- new cmGeneratorTarget(*j, this->LocalGenerators[i]);
- this->GeneratorTargets[*j] = gt;
+ cmLocalGenerator* lg = this->LocalGenerators[i];
+ cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg);
+ lg->AddOwnedImportedGeneratorTarget(gt);
importedMap[*j] = gt;
}
}
@@ -1641,9 +1638,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
//----------------------------------------------------------------------------
void cmGlobalGenerator::ClearGeneratorMembers()
{
- cmDeleteAll(this->GeneratorTargets);
- this->GeneratorTargets.clear();
-
cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
@@ -1662,20 +1656,6 @@ void cmGlobalGenerator::ClearGeneratorMembers()
}
//----------------------------------------------------------------------------
-cmGeneratorTarget*
-cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
-{
- cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
- if(ti == this->GeneratorTargets.end())
- {
- this->CMakeInstance->IssueMessage(
- cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!");
- return 0;
- }
- return ti->second;
-}
-
-//----------------------------------------------------------------------------
void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 0057d610c0..bc6e17d7ff 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -42,10 +42,6 @@ class cmInstallTargetGenerator;
class cmInstallFilesGenerator;
class cmExportBuildFileGenerator;
-typedef std::map<cmTarget const*,
- cmGeneratorTarget*,
- cmTarget::StrictTargetComparison> cmGeneratorTargetsType;
-
/** \class cmGlobalGenerator
* \brief Responsible for overseeing the generation process for the entire tree
*
@@ -307,14 +303,6 @@ public:
TargetDependSet const& GetTargetDirectDepends(
const cmGeneratorTarget* target);
- /** Get per-target generator information. */
- cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
-
- void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
- {
- this->GeneratorTargets[t] = gt;
- }
-
const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;}
@@ -482,8 +470,6 @@ private:
typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap;
TargetDependMap TargetDependencies;
- // Per-target generator information.
- cmGeneratorTargetsType GeneratorTargets;
friend class cmake;
void CreateGeneratorTargets(TargetTypes targetTypes, cmMakefile* mf,
cmLocalGenerator* lg,
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index f08ab5a372..5e239b8cd1 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -257,7 +257,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
lg->AddGeneratorTarget(gt);
- this->AddGeneratorTarget(tgt, gt);
// Organize in the "predefined targets" folder:
//
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index b819daddda..bb0c974afc 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -88,7 +88,6 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
gen[0]->AddGeneratorTarget(gt);
- this->AddGeneratorTarget(allBuild, gt);
#if 0
// Can't activate this code because we want ALL_BUILD
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6d4fc1f8fd..da8c814148 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -460,7 +460,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
root->AddGeneratorTarget(allBuildGt);
- root->GetGlobalGenerator()->AddGeneratorTarget(allbuild, allBuildGt);
// Refer to the main build configuration file for easy editing.
std::string listfile = root->GetCurrentSourceDirectory();
@@ -496,7 +495,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
root->AddGeneratorTarget(checkGt);
- root->GetGlobalGenerator()->AddGeneratorTarget(check, checkGt);
}
// now make the allbuild depend on all the non-utility targets
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ec7c29fe25..d92cbeaa4d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -62,6 +62,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator::~cmLocalGenerator()
{
+ cmDeleteAll(this->GeneratorTargets);
+ cmDeleteAll(this->OwnedImportedGeneratorTargets);
}
void cmLocalGenerator::IssueMessage(cmake::MessageType t,
@@ -460,6 +462,11 @@ void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt)
this->ImportedGeneratorTargets.push_back(gt);
}
+void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
+{
+ this->OwnedImportedGeneratorTargets.push_back(gt);
+}
+
struct NamedGeneratorTargetFinder
{
NamedGeneratorTargetFinder(std::string const& name)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 67383d7749..e2f551976d 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -127,6 +127,7 @@ public:
void AddGeneratorTarget(cmGeneratorTarget* gt);
void AddImportedGeneratorTarget(cmGeneratorTarget* gt);
+ void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt);
cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const;
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
@@ -380,6 +381,7 @@ protected:
std::set<cmGeneratorTarget const*> WarnCMP0063;
std::vector<cmGeneratorTarget*> GeneratorTargets;
std::vector<cmGeneratorTarget*> ImportedGeneratorTargets;
+ std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
std::map<std::string, std::string> AliasTargets;
bool EmitUniversalBinaryFlags;
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 225c03ee7a..b813c1463c 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -896,7 +896,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
lg->AddGeneratorTarget(gt);
- lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt);
// Set target folder
const char* autogenFolder = makefile->GetState()