diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bf0ab84bf..c19ef7d7d 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -66,4 +66,6 @@ private: void operator=(cmGeneratorTarget const&); }; +typedef std::map cmGeneratorTargetsType; + #endif diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 578fa9ec9..0b0679075 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1075,8 +1075,10 @@ void cmGlobalGenerator::CreateGeneratorTargets() // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - cmTargets& targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); + cmGeneratorTargetsType generatorTargets; + + cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { @@ -1084,14 +1086,16 @@ void cmGlobalGenerator::CreateGeneratorTargets() cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; this->ComputeTargetObjects(gt); + generatorTargets[t] = gt; } + mf->SetGeneratorTargets(generatorTargets); } } //---------------------------------------------------------------------------- void cmGlobalGenerator::ClearGeneratorTargets() { - for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); + for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); i != this->GeneratorTargets.end(); ++i) { delete i->second; @@ -1102,7 +1106,7 @@ void cmGlobalGenerator::ClearGeneratorTargets() //---------------------------------------------------------------------------- cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const { - GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); + cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); if(ti == this->GeneratorTargets.end()) { this->CMakeInstance->IssueMessage( diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce9179379..2f4ebc35a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -18,6 +18,7 @@ #include "cmTarget.h" // For cmTargets #include "cmTargetDepend.h" // For cmTargetDependSet #include "cmSystemTools.h" // for cmSystemTools::OutputOption +#include "cmGeneratorTarget.h" class cmake; class cmGeneratorTarget; class cmMakefile; @@ -383,8 +384,7 @@ private: TargetDependMap TargetDependencies; // Per-target generator information. - typedef std::map GeneratorTargetsType; - GeneratorTargetsType GeneratorTargets; + cmGeneratorTargetsType GeneratorTargets; void CreateGeneratorTargets(); void ClearGeneratorTargets(); virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 74c8039b3..4e79cea41 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -20,6 +20,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmNewLineStyle.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -519,6 +520,16 @@ public: */ const cmTargets &GetTargets() const { return this->Targets; } + const cmGeneratorTargetsType &GetGeneratorTargets() const + { + return this->GeneratorTargets; + } + + void SetGeneratorTargets(const cmGeneratorTargetsType &targets) + { + this->GeneratorTargets = targets; + } + cmTarget* FindTarget(const char* name); /** Find a target to use in place of the given name. The target @@ -865,6 +876,7 @@ protected: // libraries, classes, and executables cmTargets Targets; + cmGeneratorTargetsType GeneratorTargets; std::vector SourceFiles; // Tests