[Cmake-commits] CMake branch, next, updated. v3.3.1-2381-g34aeda5

Stephen Kelly steveire at gmail.com
Mon Aug 24 14:02:57 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  34aeda59a141683d6b8ff5dbbce4a6a3f9ca724b (commit)
       via  f4150bd88d80f4a236ea5b0d648d8cc3122092fc (commit)
       via  0178754725c61dc6778f8591db1433a6c07e9f6f (commit)
      from  60c550f84bc4a5a479392e0fe7d0b2a52d50524e (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34aeda59a141683d6b8ff5dbbce4a6a3f9ca724b
commit 34aeda59a141683d6b8ff5dbbce4a6a3f9ca724b
Merge: 60c550f f4150bd
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Aug 24 14:02:56 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Aug 24 14:02:56 2015 -0400

    Merge topic 'cmState-prop_dir' into next
    
    f4150bd8 cmState: Move directory Properties from cmMakefile.
    01787547 cmMakefile: Inline GetDefinitions into GetProperty.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4150bd88d80f4a236ea5b0d648d8cc3122092fc
commit f4150bd88d80f4a236ea5b0d648d8cc3122092fc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 18 15:18:59 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Aug 24 20:02:21 2015 +0200

    cmState: Move directory Properties from cmMakefile.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3069218..2296d5a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4075,152 +4075,28 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
 
 void cmMakefile::SetProperty(const std::string& prop, const char* value)
 {
-  if (prop == "INCLUDE_DIRECTORIES")
-    {
-    if (!value)
-      {
-      this->StateSnapshot.GetDirectory().ClearIncludeDirectories();
-      return;
-      }
-    cmListFileBacktrace lfbt = this->GetBacktrace();
-    this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt);
-    return;
-    }
-  if (prop == "COMPILE_OPTIONS")
-    {
-    if (!value)
-      {
-      this->StateSnapshot.GetDirectory().ClearCompileOptions();
-      return;
-      }
-    cmListFileBacktrace lfbt = this->GetBacktrace();
-    this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt);
-    return;
-    }
-  if (prop == "COMPILE_DEFINITIONS")
-    {
-    if (!value)
-      {
-      this->StateSnapshot.GetDirectory().ClearCompileDefinitions();
-      return;
-      }
-    cmListFileBacktrace lfbt = this->GetBacktrace();
-    this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt);
-    return;
-    }
-
-  this->Properties.SetProperty(prop, value);
+  cmListFileBacktrace lfbt = this->GetBacktrace();
+  this->StateSnapshot.GetDirectory().SetProperty(prop, value, lfbt);
 }
 
 void cmMakefile::AppendProperty(const std::string& prop,
                                 const char* value,
                                 bool asString)
 {
-  if (prop == "INCLUDE_DIRECTORIES")
-    {
-    cmListFileBacktrace lfbt = this->GetBacktrace();
-    this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value,
-                                                                     lfbt);
-    return;
-    }
-  if (prop == "COMPILE_OPTIONS")
-    {
-    cmListFileBacktrace lfbt = this->GetBacktrace();
-    this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt);
-    return;
-    }
-  if (prop == "COMPILE_DEFINITIONS")
-    {
-    cmListFileBacktrace lfbt = this->GetBacktrace();
-    this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value,
-                                                                     lfbt);
-    return;
-    }
-
-  this->Properties.AppendProperty(prop, value, asString);
+  cmListFileBacktrace lfbt = this->GetBacktrace();
+  this->StateSnapshot.GetDirectory().AppendProperty(prop, value,
+                                                    asString, lfbt);
 }
 
 const char *cmMakefile::GetProperty(const std::string& prop) const
 {
-  const bool chain = this->GetState()->
-                  IsPropertyChained(prop, cmProperty::DIRECTORY);
-  return this->GetProperty(prop, chain);
+  return this->StateSnapshot.GetDirectory().GetProperty(prop);
 }
 
 const char *cmMakefile::GetProperty(const std::string& prop,
                                     bool chain) const
 {
-  // watch for specific properties
-  static std::string output;
-  output = "";
-  if (prop == "PARENT_DIRECTORY")
-    {
-    cmState::Snapshot parent =
-        this->StateSnapshot.GetBuildsystemDirectoryParent();
-    if(parent.IsValid())
-      {
-      return parent.GetDirectory().GetCurrentSource();
-      }
-    return "";
-    }
-  else if (prop == "LISTFILE_STACK")
-    {
-    std::vector<std::string> listFiles;
-    cmState::Snapshot snp = this->StateSnapshot;
-    while (snp.IsValid())
-      {
-      listFiles.push_back(snp.GetExecutionListFile());
-      snp = snp.GetCallStackParent();
-      }
-    std::reverse(listFiles.begin(), listFiles.end());
-    output = cmJoin(listFiles, ";");
-    return output.c_str();
-    }
-  else if ( prop == "CACHE_VARIABLES" )
-    {
-    output = cmJoin(this->GetState()->GetCacheEntryKeys(), ";");
-    return output.c_str();
-    }
-  else if (prop == "VARIABLES")
-    {
-    std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
-    std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys();
-    res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
-    std::sort(res.begin(), res.end());
-    output = cmJoin(res, ";");
-    return output.c_str();
-    }
-  else if (prop == "INCLUDE_DIRECTORIES")
-    {
-    output = cmJoin(this->StateSnapshot.GetDirectory()
-                    .GetIncludeDirectoriesEntries(), ";");
-    return output.c_str();
-    }
-  else if (prop == "COMPILE_OPTIONS")
-    {
-    output = cmJoin(this->StateSnapshot.GetDirectory()
-                    .GetCompileOptionsEntries(), ";");
-    return output.c_str();
-    }
-  else if (prop == "COMPILE_DEFINITIONS")
-    {
-    output = cmJoin(this->StateSnapshot.GetDirectory()
-                    .GetCompileDefinitionsEntries(), ";");
-    return output.c_str();
-    }
-
-  const char *retVal = this->Properties.GetPropertyValue(prop);
-  if (!retVal && chain)
-    {
-    if(this->LocalGenerator->GetParent())
-      {
-      return this->LocalGenerator->GetParent()->GetMakefile()->
-        GetProperty(prop, chain);
-      }
-    return this->GetState()->GetGlobalProperty(prop);
-    }
-
-  return retVal;
+  return this->StateSnapshot.GetDirectory().GetProperty(prop, chain);
 }
 
 bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
@@ -4230,14 +4106,7 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
 
 std::vector<std::string> cmMakefile::GetPropertyKeys() const
 {
-  std::vector<std::string> keys;
-  keys.reserve(this->Properties.size());
-  for(cmPropertyMap::const_iterator it = this->Properties.begin();
-      it != this->Properties.end(); ++it)
-    {
-    keys.push_back(it->first);
-    }
-  return keys;
+  return this->StateSnapshot.GetDirectory().GetPropertyKeys();
 }
 
 cmTarget* cmMakefile::FindTarget(const std::string& name,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 9f455cc..055170a 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -14,7 +14,6 @@
 
 #include "cmExecutionStatus.h"
 #include "cmListFileCache.h"
-#include "cmPropertyMap.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmNewLineStyle.h"
@@ -903,8 +902,6 @@ private:
 
   std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
 
-  cmPropertyMap Properties;
-
   std::vector<cmCommandContext const*> ContextStack;
   std::vector<cmExecutionStatus*> ExecutionStatusStack;
   friend class cmMakefileCall;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 336ff78..53fdae0 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -74,6 +74,8 @@ struct cmState::BuildsystemDirectoryStateType
 
   std::vector<std::string> CompileOptions;
   std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
+
+  cmPropertyMap Properties;
 };
 
 cmState::cmState(cmake* cm)
@@ -271,6 +273,7 @@ cmState::Snapshot cmState::Reset()
   it->CompileOptions.clear();
   it->CompileOptionsBacktraces.clear();
   it->DirectoryEnd = pos;
+  it->Properties.clear();
   }
 
   this->PolicyStack.Clear();
@@ -1538,3 +1541,163 @@ bool cmState::Snapshot::StrictWeakOrder::operator()(
 {
   return lhs.Position.StrictWeakOrdered(rhs.Position);
 }
+
+void cmState::Directory::SetProperty(const std::string& prop,
+                                     const char* value,
+                                     cmListFileBacktrace lfbt)
+{
+  if (prop == "INCLUDE_DIRECTORIES")
+    {
+    if (!value)
+      {
+      this->ClearIncludeDirectories();
+      return;
+      }
+    this->SetIncludeDirectories(value, lfbt);
+    return;
+    }
+  if (prop == "COMPILE_OPTIONS")
+    {
+    if (!value)
+      {
+      this->ClearCompileOptions();
+      return;
+      }
+    this->SetCompileOptions(value, lfbt);
+    return;
+    }
+  if (prop == "COMPILE_DEFINITIONS")
+    {
+    if (!value)
+      {
+      this->ClearCompileDefinitions();
+      return;
+      }
+    this->SetCompileDefinitions(value, lfbt);
+    return;
+    }
+
+  this->DirectoryState->Properties.SetProperty(prop, value);
+}
+
+void cmState::Directory::AppendProperty(const std::string& prop,
+                                        const char* value,
+                                        bool asString,
+                                        cmListFileBacktrace lfbt)
+{
+  if (prop == "INCLUDE_DIRECTORIES")
+    {
+    this->AppendIncludeDirectoriesEntry(value, lfbt);
+    return;
+    }
+  if (prop == "COMPILE_OPTIONS")
+    {
+    this->AppendCompileOptionsEntry(value, lfbt);
+    return;
+    }
+  if (prop == "COMPILE_DEFINITIONS")
+    {
+    this->AppendCompileDefinitionsEntry(value, lfbt);
+    return;
+    }
+
+  this->DirectoryState->Properties.AppendProperty(prop, value, asString);
+}
+
+const char*cmState::Directory::GetProperty(const std::string& prop) const
+{
+  const bool chain = this->Snapshot_.State->
+      IsPropertyChained(prop, cmProperty::DIRECTORY);
+  return this->GetProperty(prop, chain);
+}
+
+const char*
+cmState::Directory::GetProperty(const std::string& prop, bool chain) const
+{
+  static std::string output;
+  output = "";
+  if (prop == "PARENT_DIRECTORY")
+    {
+    cmState::Snapshot parent =
+        this->Snapshot_.GetBuildsystemDirectoryParent();
+    if(parent.IsValid())
+      {
+      return parent.GetDirectory().GetCurrentSource();
+      }
+    return "";
+    }
+  else if (prop == "LISTFILE_STACK")
+    {
+    std::vector<std::string> listFiles;
+    cmState::Snapshot snp = this->Snapshot_;
+    while (snp.IsValid())
+      {
+      listFiles.push_back(snp.GetExecutionListFile());
+      snp = snp.GetCallStackParent();
+      }
+    std::reverse(listFiles.begin(), listFiles.end());
+    output = cmJoin(listFiles, ";");
+    return output.c_str();
+    }
+  else if ( prop == "CACHE_VARIABLES" )
+    {
+    output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";");
+    return output.c_str();
+    }
+  else if (prop == "VARIABLES")
+    {
+    std::vector<std::string> res = this->Snapshot_.ClosureKeys();
+    std::vector<std::string> cacheKeys =
+        this->Snapshot_.State->GetCacheEntryKeys();
+    res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
+    std::sort(res.begin(), res.end());
+    output = cmJoin(res, ";");
+    return output.c_str();
+    }
+  else if (prop == "INCLUDE_DIRECTORIES")
+    {
+    output = cmJoin(this->GetIncludeDirectoriesEntries(), ";");
+    return output.c_str();
+    }
+  else if (prop == "COMPILE_OPTIONS")
+    {
+    output = cmJoin(this->GetCompileOptionsEntries(), ";");
+    return output.c_str();
+    }
+  else if (prop == "COMPILE_DEFINITIONS")
+    {
+    output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
+    return output.c_str();
+    }
+
+  const char *retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
+  if (!retVal && chain)
+    {
+    Snapshot parentSnapshot = this->Snapshot_.GetBuildsystemDirectoryParent();
+    if (parentSnapshot.IsValid())
+      {
+      return parentSnapshot.GetDirectory().GetProperty(prop, chain);
+      }
+    return this->Snapshot_.State->GetGlobalProperty(prop);
+    }
+
+  return retVal;
+}
+
+bool cmState::Directory::GetPropertyAsBool(const std::string& prop) const
+{
+  return cmSystemTools::IsOn(this->GetProperty(prop));
+}
+
+std::vector<std::string> cmState::Directory::GetPropertyKeys() const
+{
+  std::vector<std::string> keys;
+  keys.reserve(this->DirectoryState->Properties.size());
+  for(cmPropertyMap::const_iterator it =
+      this->DirectoryState->Properties.begin();
+      it != this->DirectoryState->Properties.end(); ++it)
+    {
+    keys.push_back(it->first);
+    }
+  return keys;
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index 86945f6..e503cd2 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -146,6 +146,15 @@ public:
                                cmListFileBacktrace const& lfbt);
     void ClearCompileOptions();
 
+    void SetProperty(const std::string& prop, const char *value,
+                     cmListFileBacktrace lfbt);
+    void AppendProperty(const std::string& prop, const char *value,
+                        bool asString, cmListFileBacktrace lfbt);
+    const char *GetProperty(const std::string& prop) const;
+    const char *GetProperty(const std::string& prop, bool chain) const;
+    bool GetPropertyAsBool(const std::string& prop) const;
+    std::vector<std::string> GetPropertyKeys() const;
+
   private:
     void ComputeRelativePathTopSource();
     void ComputeRelativePathTopBinary();

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0178754725c61dc6778f8591db1433a6c07e9f6f
commit 0178754725c61dc6778f8591db1433a6c07e9f6f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 18 14:54:14 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Aug 24 19:48:45 2015 +0200

    cmMakefile: Inline GetDefinitions into GetProperty.
    
    It will soon move to cmState.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7ad37e6..3069218 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4183,7 +4183,11 @@ const char *cmMakefile::GetProperty(const std::string& prop,
     }
   else if (prop == "VARIABLES")
     {
-    output = cmJoin(this->GetDefinitions(), ";");
+    std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
+    std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys();
+    res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
+    std::sort(res.begin(), res.end());
+    output = cmJoin(res, ";");
     return output.c_str();
     }
   else if (prop == "INCLUDE_DIRECTORIES")

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

Summary of changes:
 Source/cmMakefile.cxx |  143 +++----------------------------------------
 Source/cmMakefile.h   |    3 -
 Source/cmState.cxx    |  163 +++++++++++++++++++++++++++++++++++++++++++++++++
 Source/cmState.h      |    9 +++
 4 files changed, 180 insertions(+), 138 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list