[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-106-g4eafc01

Stephen Kelly steveire at gmail.com
Tue Oct 6 16:04:52 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  4eafc01acb0a24effedaa6b1f9d798a8f971d852 (commit)
       via  852e9b1b54d755dda1e8ca131c7aed247e8ab311 (commit)
       via  86db10d78e429b9a934649c15d2cad91c1860576 (commit)
       via  09898c15aacbeda92f34721c3283c730d00a66c3 (commit)
       via  f716460ed82134bd1ca09f49bfa507cb2645d96c (commit)
      from  c54c869a7127352d7e2ca757c5ecd039d12ae2ab (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4eafc01acb0a24effedaa6b1f9d798a8f971d852
commit 4eafc01acb0a24effedaa6b1f9d798a8f971d852
Merge: c54c869 852e9b1
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 6 16:04:50 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 6 16:04:50 2015 -0400

    Merge topic 'refactor-current-dir-initialization' into next
    
    852e9b1b cmState: Internalize the initialization of a snapshot from its parent.
    86db10d7 Remove now-unused directory setters.
    09898c15 Set the current dirs on the snapshot before creating the cmMakefile.
    f716460e cmMakefile: Move invokation to initialize snapshot.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=852e9b1b54d755dda1e8ca131c7aed247e8ab311
commit 852e9b1b54d755dda1e8ca131c7aed247e8ab311
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 6 00:33:49 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 6 21:50:44 2015 +0200

    cmState: Internalize the initialization of a snapshot from its parent.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2c9dfbb..c060505 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1761,8 +1761,6 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
                                            this->ContextStack.back()->Name,
                                            this->ContextStack.back()->Line);
 
-  newSnapshot.InitializeFromParent();
-
   newSnapshot.GetDirectory().SetCurrentSource(srcPath);
   newSnapshot.GetDirectory().SetCurrentBinary(binPath);
 
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index ce9ff32..db7519b 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -805,8 +805,10 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
   pos->Parent = origin;
   pos->Root = origin;
   pos->Vars = this->VarTree.Extend(origin);
+
   cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
   originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
+  snapshot.InitializeFromParent();
   return snapshot;
 }
 
diff --git a/Source/cmState.h b/Source/cmState.h
index 99e537c..1ffc4bf 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -75,8 +75,6 @@ public:
     Snapshot GetCallStackParent() const;
     SnapshotType GetType() const;
 
-    void InitializeFromParent();
-
     void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
     cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const;
     bool HasDefinedPolicyCMP0011();
@@ -105,6 +103,9 @@ public:
     friend class cmState;
     friend class Directory;
     friend struct StrictWeakOrder;
+
+    void InitializeFromParent();
+
     cmState* State;
     cmState::PositionType Position;
   };

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86db10d78e429b9a934649c15d2cad91c1860576
commit 86db10d78e429b9a934649c15d2cad91c1860576
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 6 00:24:26 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 6 21:49:51 2015 +0200

    Remove now-unused directory setters.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 11a949f..2c9dfbb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1784,26 +1784,11 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
     }
 }
 
-void cmMakefile::SetCurrentSourceDirectory(const std::string& dir)
-{
-  this->StateSnapshot.GetDirectory().SetCurrentSource(dir);
-  this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
-                      this->StateSnapshot.GetDirectory().GetCurrentSource());
-}
-
 const char* cmMakefile::GetCurrentSourceDirectory() const
 {
   return this->StateSnapshot.GetDirectory().GetCurrentSource();
 }
 
-void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir)
-{
-  this->StateSnapshot.GetDirectory().SetCurrentBinary(dir);
-  const char* binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
-  cmSystemTools::MakeDirectory(binDir);
-  this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", binDir);
-}
-
 const char* cmMakefile::GetCurrentBinaryDirectory() const
 {
   return this->StateSnapshot.GetDirectory().GetCurrentBinary();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 8724c6e..459d34c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -353,9 +353,7 @@ public:
    */
   void SetArgcArgv(const std::vector<std::string>& args);
 
-  void SetCurrentSourceDirectory(const std::string& dir);
   const char* GetCurrentSourceDirectory() const;
-  void SetCurrentBinaryDirectory(const std::string& dir);
   const char* GetCurrentBinaryDirectory() const;
 
   //@}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09898c15aacbeda92f34721c3283c730d00a66c3
commit 09898c15aacbeda92f34721c3283c730d00a66c3
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 31 01:57:04 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 6 21:47:21 2015 +0200

    Set the current dirs on the snapshot before creating the cmMakefile.
    
    The cmMakefile should get a fully prepared snapshot and not clobber its
    definitions.  It should eventually be able to process list files from any
    starting-point snapshot, though that is some refactoring away still.

diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 2f125aa..b9016af 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -318,16 +318,13 @@ void cmCTestScriptHandler::CreateCMake()
   this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
 
   cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
+  std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
+  snapshot.GetDirectory().SetCurrentSource(cwd);
+  snapshot.GetDirectory().SetCurrentBinary(cwd);
   this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot);
 
   this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
 
-  // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR.
-  // Also, some commands need Makefile->GetCurrentSourceDirectory().
-  std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
-  this->Makefile->SetCurrentSourceDirectory(cwd);
-  this->Makefile->SetCurrentBinaryDirectory(cwd);
-
   // remove all cmake commands which are not scriptable, since they can't be
   // used in ctest scripts
   this->CMake->GetState()->RemoveUnscriptableCommands();
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 05f1029..715a927 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1108,16 +1108,16 @@ void cmGlobalGenerator::Configure()
   this->FirstTimeProgress = 0.0f;
   this->ClearGeneratorMembers();
 
-  cmMakefile* dirMf =
-      new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot());
-  this->Makefiles.push_back(dirMf);
+  cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
 
-  // set the Start directories
-  dirMf->SetCurrentSourceDirectory
+  snapshot.GetDirectory().SetCurrentSource
     (this->CMakeInstance->GetHomeDirectory());
-  dirMf->SetCurrentBinaryDirectory
+  snapshot.GetDirectory().SetCurrentBinary
     (this->CMakeInstance->GetHomeOutputDirectory());
 
+  cmMakefile* dirMf = new cmMakefile(this, snapshot);
+  this->Makefiles.push_back(dirMf);
+
   this->BinaryDirectories.insert(
       this->CMakeInstance->GetHomeOutputDirectory());
 
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 0064713..cb13fcf 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -585,12 +585,11 @@ void cmGlobalUnixMakefileGenerator3
     else
       {
       cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
-      mf = new cmMakefile(this, snapshot);
-      // set the Start directories
-      mf->SetCurrentSourceDirectory
+      snapshot.GetDirectory().SetCurrentSource
         (this->CMakeInstance->GetHomeDirectory());
-      mf->SetCurrentBinaryDirectory
+      snapshot.GetDirectory().SetCurrentBinary
         (this->CMakeInstance->GetHomeOutputDirectory());
+      mf = new cmMakefile(this, snapshot);
       }
 
     std::string tname = targetName;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e522320..11a949f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -120,15 +120,34 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
   this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
 #endif
 
+  this->AddDefinition("CMAKE_SOURCE_DIR",
+                      this->GetCMakeInstance()->GetHomeDirectory());
+  this->AddDefinition("CMAKE_BINARY_DIR",
+                      this->GetCMakeInstance()->GetHomeOutputDirectory());
   {
-  const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
-  this->AddDefinition("CMAKE_SOURCE_DIR", dir);
-  this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
+  const char* dir = this->StateSnapshot.GetDirectory().GetCurrentSource();
+  if (dir)
+    {
+    this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
+    }
+  else
+    {
+    this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
+                        this->GetCMakeInstance()->GetHomeDirectory());
+    }
   }
   {
-  const char* dir = this->GetCMakeInstance()->GetHomeOutputDirectory();
-  this->AddDefinition("CMAKE_BINARY_DIR", dir);
-  this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
+  const char* dir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
+  if (dir)
+    {
+    cmSystemTools::MakeDirectory(dir);
+    this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
+    }
+  else
+    {
+    this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
+                        this->GetCMakeInstance()->GetHomeOutputDirectory());
+    }
   }
 }
 
@@ -1472,11 +1491,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib)
 
 void cmMakefile::InitializeFromParent(cmMakefile* parent)
 {
-  this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
-                      this->GetCurrentSourceDirectory());
-  this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
-                      this->GetCurrentBinaryDirectory());
-
   this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
 
   // define flags
@@ -1747,14 +1761,13 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
                                            this->ContextStack.back()->Name,
                                            this->ContextStack.back()->Line);
 
-  cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
-  this->GetGlobalGenerator()->AddMakefile(subMf);
+  newSnapshot.InitializeFromParent();
 
-  // set the subdirs start dirs
-  subMf->SetCurrentSourceDirectory(srcPath);
-  subMf->SetCurrentBinaryDirectory(binPath);
+  newSnapshot.GetDirectory().SetCurrentSource(srcPath);
+  newSnapshot.GetDirectory().SetCurrentBinary(binPath);
 
-  subMf->StateSnapshot.InitializeFromParent();
+  cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
+  this->GetGlobalGenerator()->AddMakefile(subMf);
 
   if(excludeFromAll)
     {
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index bbeb3dc..36b1305 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -178,9 +178,10 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
   cmGlobalGenerator gg(&cm);
 
   cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+  snapshot.GetDirectory().SetCurrentBinary(targetDirectory);
+  snapshot.GetDirectory().SetCurrentSource(targetDirectory);
+
   cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot));
-  mf->SetCurrentBinaryDirectory(targetDirectory);
-  mf->SetCurrentSourceDirectory(targetDirectory);
   gg.SetCurrentMakefile(mf.get());
 
   this->ReadAutogenInfoFile(mf.get(), targetDirectory, config);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2aa092a..183b6e7 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -377,10 +377,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
     this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
     this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
     cmState::Snapshot snapshot = this->GetCurrentSnapshot();
-    cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
-    mf->SetCurrentBinaryDirectory
+    snapshot.GetDirectory().SetCurrentBinary
       (cmSystemTools::GetCurrentWorkingDirectory());
-    mf->SetCurrentSourceDirectory
+    snapshot.GetDirectory().SetCurrentSource
       (cmSystemTools::GetCurrentWorkingDirectory());
     if (this->GetWorkingMode() != NORMAL_MODE)
       {
@@ -418,13 +417,13 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
   this->SetGlobalGenerator(gg);
 
   cmState::Snapshot snapshot = this->GetCurrentSnapshot();
+  snapshot.GetDirectory().SetCurrentBinary
+    (cmSystemTools::GetCurrentWorkingDirectory());
+  snapshot.GetDirectory().SetCurrentSource
+    (cmSystemTools::GetCurrentWorkingDirectory());
   // read in the list file to fill the cache
   cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
   cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
-  mf->SetCurrentBinaryDirectory
-    (cmSystemTools::GetCurrentWorkingDirectory());
-  mf->SetCurrentSourceDirectory
-    (cmSystemTools::GetCurrentWorkingDirectory());
 
   mf->SetArgcArgv(args);
 
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f44c77d..ca46111 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -769,11 +769,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         {
         cm.SetGlobalGenerator(ggd);
         cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+        snapshot.GetDirectory().SetCurrentBinary
+          (cmSystemTools::GetCurrentWorkingDirectory());
+        snapshot.GetDirectory().SetCurrentSource
+          (cmSystemTools::GetCurrentWorkingDirectory());
         cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
         cmsys::auto_ptr<cmLocalGenerator> lgd(
               ggd->CreateLocalGenerator(mf.get()));
-        lgd->GetMakefile()->SetCurrentSourceDirectory(startDir);
-        lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);
 
         // Actually scan dependencies.
         return lgd->UpdateDependencies(depInfo.c_str(),

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f716460ed82134bd1ca09f49bfa507cb2645d96c
commit f716460ed82134bd1ca09f49bfa507cb2645d96c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 6 00:04:30 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 6 21:46:09 2015 +0200

    cmMakefile: Move invokation to initialize snapshot.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 077470d..e522320 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1472,8 +1472,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib)
 
 void cmMakefile::InitializeFromParent(cmMakefile* parent)
 {
-  this->StateSnapshot.InitializeFromParent();
-
   this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
                       this->GetCurrentSourceDirectory());
   this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
@@ -1755,6 +1753,9 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
   // set the subdirs start dirs
   subMf->SetCurrentSourceDirectory(srcPath);
   subMf->SetCurrentBinaryDirectory(binPath);
+
+  subMf->StateSnapshot.InitializeFromParent();
+
   if(excludeFromAll)
     {
     subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE");

-----------------------------------------------------------------------

Summary of changes:
 Source/CTest/cmCTestScriptHandler.cxx     |    9 ++---
 Source/cmGlobalGenerator.cxx              |   12 +++---
 Source/cmGlobalUnixMakefileGenerator3.cxx |    7 ++--
 Source/cmMakefile.cxx                     |   59 ++++++++++++++---------------
 Source/cmMakefile.h                       |    2 -
 Source/cmQtAutoGenerators.cxx             |    5 ++-
 Source/cmState.cxx                        |    2 +
 Source/cmState.h                          |    5 ++-
 Source/cmake.cxx                          |   13 +++----
 Source/cmcmd.cxx                          |    6 ++-
 10 files changed, 58 insertions(+), 62 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list