diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-30 17:50:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-04 13:06:41 (GMT) |
commit | f059ed165bafff94f9bcd3823e12a8ce1f5ec647 (patch) | |
tree | edd12618c7b9e6f6b94a2d9b7882fbb5e9077768 /Source/cmMakefile.cxx | |
parent | a653611db0d6e23456c5ef90f95e19ea5d70a428 (diff) | |
download | CMake-f059ed165bafff94f9bcd3823e12a8ce1f5ec647.zip CMake-f059ed165bafff94f9bcd3823e12a8ce1f5ec647.tar.gz CMake-f059ed165bafff94f9bcd3823e12a8ce1f5ec647.tar.bz2 |
cmMakefile: Move Configure responsibility from cmLocalGenerator.
The generator should only have a function at generate time.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 68 |
1 files changed, 59 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ffc6bf9..05e80d7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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()) { |