cmLocalGenerator: Implement child traversal in terms of cmState.

This commit is contained in:
Stephen Kelly 2015-07-19 16:33:54 +02:00
parent 3fcf383763
commit 6c832219ea
2 changed files with 16 additions and 11 deletions

View File

@ -495,10 +495,12 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the directory-level // The directory-level rule should depend on the directory-level
// rules of the subdirectories. // rules of the subdirectories.
for(std::vector<cmLocalGenerator*>::iterator sdi = std::vector<cmState::Snapshot> children
lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi) = lg->GetMakefile()->GetStateSnapshot().GetChildren();
for(std::vector<cmState::Snapshot>::const_iterator
ci = children.begin(); ci != children.end(); ++ci)
{ {
std::string subdir = (*sdi)->GetMakefile()->GetCurrentBinaryDirectory(); std::string subdir = ci->GetDirectory().GetCurrentBinary();
subdir += "/"; subdir += "/";
subdir += pass; subdir += pass;
depends.push_back(subdir); depends.push_back(subdir);

View File

@ -200,12 +200,13 @@ void cmLocalGenerator::GenerateTestFiles()
(*gi)->Generate(fout, config, configurationTypes); (*gi)->Generate(fout, config, configurationTypes);
} }
size_t i; size_t i;
for(i = 0; i < this->Children.size(); ++i) std::vector<cmState::Snapshot> children
= this->Makefile->GetStateSnapshot().GetChildren();
for(i = 0; i < children.size(); ++i)
{ {
// TODO: Use add_subdirectory instead? // TODO: Use add_subdirectory instead?
fout << "subdirs("; fout << "subdirs(";
std::string outP = std::string outP = children[i].GetDirectory().GetCurrentBinary();
this->Children[i]->GetMakefile()->GetCurrentBinaryDirectory();
fout << this->Convert(outP,START_OUTPUT); fout << this->Convert(outP,START_OUTPUT);
fout << ")" << std::endl; fout << ")" << std::endl;
} }
@ -413,16 +414,18 @@ void cmLocalGenerator::GenerateInstallRules()
this->GenerateTargetInstallRules(fout, config, configurationTypes); this->GenerateTargetInstallRules(fout, config, configurationTypes);
// Include install scripts from subdirectories. // Include install scripts from subdirectories.
if(!this->Children.empty()) std::vector<cmState::Snapshot> children
= this->Makefile->GetStateSnapshot().GetChildren();
if(!children.empty())
{ {
fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n"; fout << " # Include the install script for each subdirectory.\n";
for(std::vector<cmLocalGenerator*>::const_iterator for(std::vector<cmState::Snapshot>::const_iterator
ci = this->Children.begin(); ci != this->Children.end(); ++ci) ci = children.begin(); ci != children.end(); ++ci)
{ {
if(!(*ci)->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL")) if(!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{ {
std::string odir = (*ci)->GetMakefile()->GetCurrentBinaryDirectory(); std::string odir = ci->GetDirectory().GetCurrentBinary();
cmSystemTools::ConvertToUnixSlashes(odir); cmSystemTools::ConvertToUnixSlashes(odir);
fout << " include(\"" << odir fout << " include(\"" << odir
<< "/cmake_install.cmake\")" << std::endl; << "/cmake_install.cmake\")" << std::endl;