cmMakefile: Move Configure responsibility from cmLocalGenerator.
The generator should only have a function at generate time.
This commit is contained in:
parent
a653611db0
commit
f059ed165b
|
@ -1106,7 +1106,7 @@ void cmGlobalGenerator::Configure()
|
|||
this->CMakeInstance->GetHomeOutputDirectory());
|
||||
|
||||
// now do it
|
||||
lg->Configure();
|
||||
lg->GetMakefile()->Configure();
|
||||
|
||||
// update the cache entry for the number of local generators, this is used
|
||||
// for progress
|
||||
|
|
|
@ -74,68 +74,6 @@ bool cmLocalGenerator::IsRootMakefile() const
|
|||
return !this->StateSnapshot.GetParent().IsValid();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class cmLocalGeneratorCurrent
|
||||
{
|
||||
cmGlobalGenerator* GG;
|
||||
cmMakefile* MF;
|
||||
cmState::Snapshot Snapshot;
|
||||
public:
|
||||
cmLocalGeneratorCurrent(cmMakefile* mf)
|
||||
{
|
||||
this->GG = mf->GetGlobalGenerator();
|
||||
this->MF = this->GG->GetCurrentMakefile();
|
||||
this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
|
||||
this->GG->GetCMakeInstance()->SetCurrentSnapshot(
|
||||
this->GG->GetCMakeInstance()->GetCurrentSnapshot());
|
||||
this->GG->SetCurrentMakefile(mf);
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
this->GG->GetFileLockPool().PushFileScope();
|
||||
#endif
|
||||
}
|
||||
~cmLocalGeneratorCurrent()
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
this->GG->GetFileLockPool().PopFileScope();
|
||||
#endif
|
||||
this->GG->SetCurrentMakefile(this->MF);
|
||||
this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::Configure()
|
||||
{
|
||||
// Manage the global generator's current local generator.
|
||||
cmLocalGeneratorCurrent clg(this->GetMakefile());
|
||||
static_cast<void>(clg);
|
||||
|
||||
// make sure the CMakeFiles dir is there
|
||||
std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
|
||||
filesDir += cmake::GetCMakeFilesDirectory();
|
||||
cmSystemTools::MakeDirectory(filesDir.c_str());
|
||||
|
||||
std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
|
||||
currentStart += "/CMakeLists.txt";
|
||||
assert(cmSystemTools::FileExists(currentStart.c_str(), true));
|
||||
this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
|
||||
|
||||
// at the end handle any old style subdirs
|
||||
std::vector<cmLocalGenerator *> subdirs =
|
||||
this->GetMakefile()->GetUnConfiguredDirectories();
|
||||
|
||||
// for each subdir recurse
|
||||
std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin();
|
||||
for (; sdi != subdirs.end(); ++sdi)
|
||||
{
|
||||
this->Makefile->ConfigureSubDirectory(*sdi);
|
||||
}
|
||||
|
||||
this->Makefile->AddCMakeDependFilesFromUser();
|
||||
|
||||
this->Makefile->SetConfigured();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::ComputeObjectMaxPath()
|
||||
{
|
||||
|
|
|
@ -46,12 +46,6 @@ public:
|
|||
*/
|
||||
virtual void Generate() {}
|
||||
|
||||
/**
|
||||
* Process the CMakeLists files for this directory to fill in the
|
||||
* Makefile ivar
|
||||
*/
|
||||
void Configure();
|
||||
|
||||
/**
|
||||
* Calls TraceVSDependencies() on all targets of this generator.
|
||||
*/
|
||||
|
|
|
@ -1553,6 +1553,64 @@ void cmMakefile::InitializeFromParent()
|
|||
this->ImportedTargets = parent->ImportedTargets;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class cmMakefileCurrent
|
||||
{
|
||||
cmGlobalGenerator* GG;
|
||||
cmMakefile* MF;
|
||||
cmState::Snapshot Snapshot;
|
||||
public:
|
||||
cmMakefileCurrent(cmMakefile* mf)
|
||||
{
|
||||
this->GG = mf->GetGlobalGenerator();
|
||||
this->MF = this->GG->GetCurrentMakefile();
|
||||
this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
|
||||
this->GG->GetCMakeInstance()->SetCurrentSnapshot(
|
||||
this->GG->GetCMakeInstance()->GetCurrentSnapshot());
|
||||
this->GG->SetCurrentMakefile(mf);
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
this->GG->GetFileLockPool().PushFileScope();
|
||||
#endif
|
||||
}
|
||||
~cmMakefileCurrent()
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
this->GG->GetFileLockPool().PopFileScope();
|
||||
#endif
|
||||
this->GG->SetCurrentMakefile(this->MF);
|
||||
this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmMakefile::Configure()
|
||||
{
|
||||
cmMakefileCurrent cmf(this);
|
||||
|
||||
// make sure the CMakeFiles dir is there
|
||||
std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
|
||||
filesDir += cmake::GetCMakeFilesDirectory();
|
||||
cmSystemTools::MakeDirectory(filesDir.c_str());
|
||||
|
||||
std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
|
||||
currentStart += "/CMakeLists.txt";
|
||||
assert(cmSystemTools::FileExists(currentStart.c_str(), true));
|
||||
this->ProcessBuildsystemFile(currentStart.c_str());
|
||||
|
||||
// at the end handle any old style subdirs
|
||||
std::vector<cmLocalGenerator*> subdirs = this->UnConfiguredDirectories;
|
||||
|
||||
// for each subdir recurse
|
||||
std::vector<cmLocalGenerator*>::iterator sdi = subdirs.begin();
|
||||
for (; sdi != subdirs.end(); ++sdi)
|
||||
{
|
||||
this->ConfigureSubDirectory(*sdi);
|
||||
}
|
||||
|
||||
this->AddCMakeDependFilesFromUser();
|
||||
this->SetConfigured();
|
||||
}
|
||||
|
||||
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
||||
{
|
||||
lg2->GetMakefile()->InitializeFromParent();
|
||||
|
@ -1598,15 +1656,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
|||
return;
|
||||
}
|
||||
// finally configure the subdir
|
||||
lg2->Configure();
|
||||
|
||||
// at the end handle any old style subdirs
|
||||
for (std::vector<cmLocalGenerator *>::iterator sdi =
|
||||
this->UnConfiguredDirectories.begin();
|
||||
sdi != this->UnConfiguredDirectories.end(); ++sdi)
|
||||
{
|
||||
this->ConfigureSubDirectory(*sdi);
|
||||
}
|
||||
lg2->GetMakefile()->Configure();
|
||||
|
||||
if (this->GetCMakeInstance()->GetDebugOutput())
|
||||
{
|
||||
|
|
|
@ -262,11 +262,6 @@ public:
|
|||
this->LinkDirectories = vec;
|
||||
}
|
||||
|
||||
std::vector<cmLocalGenerator*> GetUnConfiguredDirectories() const
|
||||
{
|
||||
return this->UnConfiguredDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a subdirectory to the build.
|
||||
*/
|
||||
|
@ -275,6 +270,8 @@ public:
|
|||
bool excludeFromAll,
|
||||
bool immediate);
|
||||
|
||||
void Configure();
|
||||
|
||||
/**
|
||||
* Configure a subdirectory
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue