diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 62 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 68 | ||||
-rw-r--r-- | Source/cmMakefile.h | 7 |
5 files changed, 62 insertions, 83 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1ee5500..1d11475 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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 diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4b9415b..8fcc2ec 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -75,68 +75,6 @@ bool cmLocalGenerator::IsRootMakefile() const } //---------------------------------------------------------------------------- -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() { // Choose a maximum object file name length. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index c972e8f..1359dd6 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -47,12 +47,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. */ void TraceDependencies(); 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()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 509f5c8..e36df36 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -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 */ |