Store cmGeneratorTargets with the makefile.

This commit is contained in:
Stephen Kelly 2012-09-13 00:03:23 +02:00
parent f428ca25f5
commit 14bf7783f4
4 changed files with 24 additions and 6 deletions

View File

@ -66,4 +66,6 @@ private:
void operator=(cmGeneratorTarget const&);
};
typedef std::map<cmTarget*, cmGeneratorTarget*> cmGeneratorTargetsType;
#endif

View File

@ -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(

View File

@ -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<cmTarget*, cmGeneratorTarget*> GeneratorTargetsType;
GeneratorTargetsType GeneratorTargets;
cmGeneratorTargetsType GeneratorTargets;
void CreateGeneratorTargets();
void ClearGeneratorTargets();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;

View File

@ -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<cmSourceFile*> SourceFiles;
// Tests