cmGlobalGenerator: Store a container of cmMakefiles.

For use at configure-time.
This commit is contained in:
Stephen Kelly 2015-08-02 20:21:22 +02:00
parent 193699376a
commit 73e4df99cb
3 changed files with 14 additions and 0 deletions

View File

@ -1129,6 +1129,7 @@ void cmGlobalGenerator::Configure()
// start with this directory // start with this directory
cmLocalGenerator *lg = this->MakeLocalGenerator(); cmLocalGenerator *lg = this->MakeLocalGenerator();
this->Makefiles.push_back(lg->GetMakefile());
this->LocalGenerators.push_back(lg); this->LocalGenerators.push_back(lg);
// set the Start directories // set the Start directories
@ -1599,6 +1600,8 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll(this->BuildExportSets); cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear(); this->BuildExportSets.clear();
this->Makefiles.clear();
cmDeleteAll(this->LocalGenerators); cmDeleteAll(this->LocalGenerators);
this->LocalGenerators.clear(); this->LocalGenerators.clear();
@ -1928,6 +1931,12 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
return makeCommand; return makeCommand;
} }
//----------------------------------------------------------------------------
void cmGlobalGenerator::AddMakefile(cmMakefile *mf)
{
this->Makefiles.push_back(mf);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
{ {

View File

@ -173,6 +173,8 @@ public:
cmake *GetCMakeInstance() const { return this->CMakeInstance; } cmake *GetCMakeInstance() const { return this->CMakeInstance; }
void SetConfiguredFilesPath(cmGlobalGenerator* gen); void SetConfiguredFilesPath(cmGlobalGenerator* gen);
const std::vector<cmMakefile*>& GetMakefiles() const {
return this->Makefiles;}
const std::vector<cmLocalGenerator *>& GetLocalGenerators() const { const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
return this->LocalGenerators;} return this->LocalGenerators;}
@ -184,6 +186,7 @@ public:
void SetCurrentMakefile(cmMakefile* mf) void SetCurrentMakefile(cmMakefile* mf)
{this->CurrentMakefile = mf;} {this->CurrentMakefile = mf;}
void AddMakefile(cmMakefile *mf);
void AddLocalGenerator(cmLocalGenerator *lg); void AddLocalGenerator(cmLocalGenerator *lg);
///! Set an generator for an "external makefile based project" ///! Set an generator for an "external makefile based project"
@ -402,6 +405,7 @@ protected:
std::string FindMakeProgramFile; std::string FindMakeProgramFile;
std::string ConfiguredFilesPath; std::string ConfiguredFilesPath;
cmake *CMakeInstance; cmake *CMakeInstance;
std::vector<cmMakefile*> Makefiles;
std::vector<cmLocalGenerator *> LocalGenerators; std::vector<cmLocalGenerator *> LocalGenerators;
cmMakefile* CurrentMakefile; cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project // map from project name to vector of local generators in that project

View File

@ -1857,6 +1857,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
// create a new local generator and set its parent // create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator() cmLocalGenerator *lg2 = this->GetGlobalGenerator()
->MakeLocalGenerator(newSnapshot, this->LocalGenerator); ->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile());
this->GetGlobalGenerator()->AddLocalGenerator(lg2); this->GetGlobalGenerator()->AddLocalGenerator(lg2);
cmMakefile* subMf = lg2->GetMakefile(); cmMakefile* subMf = lg2->GetMakefile();