summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-04 13:13:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-06-04 13:13:35 (GMT)
commit0886880e3b8e5510f861b2e573b311c16db9d657 (patch)
treee03b827e93a51589283c08fdd689fd75357ee40b /Source/cmMakefile.cxx
parentd6fe79f3abc211361f0aee909e08fd6a1531a68b (diff)
parent7657e8b1df64ed3b5429be34416e8756b659d525 (diff)
downloadCMake-0886880e3b8e5510f861b2e573b311c16db9d657.zip
CMake-0886880e3b8e5510f861b2e573b311c16db9d657.tar.gz
CMake-0886880e3b8e5510f861b2e573b311c16db9d657.tar.bz2
Merge topic 'cmMakefile-Configure'
7657e8b1 cmMakefile: Introduce a local cmMakefile variable. 4e8f242d cmMakefile: Store unconfigured cmMakefiles. d65e0123 cmMakefile: Implement ConfigureSubDirectory in terms of cmMakefile. f059ed16 cmMakefile: Move Configure responsibility from cmLocalGenerator. a653611d cmake: Replace CurrentLocalGenerator concept with CurrentMakefile. 69a038a9 cmMakefile: Refactor directories specified with the subdirs command. 08637970 cmLocalGenerator: ComputeObjectMaxPath just before generating. 27e11c6f Merge Configure state with GeneratingBuildSystem state. 363caa2f cmLocalGenerator: De-virtualize Configure().
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx85
1 files changed, 75 insertions, 10 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 473b7d2..b5d976a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -146,7 +146,7 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
- this->GeneratingBuildSystem = false;
+ this->Configured = false;
this->SuppressWatches = false;
// Setup the default include file regular expression (match everything).
@@ -1562,10 +1562,68 @@ void cmMakefile::InitializeFromParent()
this->ImportedTargets = parent->ImportedTargets;
}
-void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
+//----------------------------------------------------------------------------
+class cmMakefileCurrent
{
- lg2->GetMakefile()->InitializeFromParent();
- std::string currentStart = lg2->GetMakefile()->GetCurrentSourceDirectory();
+ 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<cmMakefile*> subdirs = this->UnConfiguredDirectories;
+
+ // for each subdir recurse
+ std::vector<cmMakefile*>::iterator sdi = subdirs.begin();
+ for (; sdi != subdirs.end(); ++sdi)
+ {
+ this->ConfigureSubDirectory(*sdi);
+ }
+
+ this->AddCMakeDependFilesFromUser();
+ this->SetConfigured();
+}
+
+void cmMakefile::ConfigureSubDirectory(cmMakefile *mf)
+{
+ mf->InitializeFromParent();
+ std::string currentStart = mf->GetCurrentSourceDirectory();
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Entering ";
@@ -1603,11 +1661,12 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
// NEW behavior prints the error.
this->IssueMessage(cmake::FATAL_ERROR, e.str());
}
- lg2->SetConfiguredCMP0014(true);
+ mf->SetConfigured();
return;
}
// finally configure the subdir
- lg2->Configure();
+ mf->Configure();
+
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Returning to ";
@@ -1635,17 +1694,23 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
this->GetGlobalGenerator()->AddLocalGenerator(lg2);
+ cmMakefile* subMf = lg2->GetMakefile();
+
// set the subdirs start dirs
- lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath);
- lg2->GetMakefile()->SetCurrentBinaryDirectory(binPath);
+ subMf->SetCurrentSourceDirectory(srcPath);
+ subMf->SetCurrentBinaryDirectory(binPath);
if(excludeFromAll)
{
- lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
+ subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
if (immediate)
{
- this->ConfigureSubDirectory(lg2);
+ this->ConfigureSubDirectory(subMf);
+ }
+ else
+ {
+ this->UnConfiguredDirectories.push_back(subMf);
}
}