[Cmake-commits] CMake branch, next, updated. v2.8.1-1389-gb31da59

Brad King brad.king at kitware.com
Fri Jun 11 16:03:07 EDT 2010


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  b31da59e5287738c109640936a9f605fd3875148 (commit)
       via  2d9dc9ac6560214de280aaab2264812a274aa7ba (commit)
      from  bcc816a7e89b1c241f70b9b8feda45958219201f (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=b31da59e5287738c109640936a9f605fd3875148
commit b31da59e5287738c109640936a9f605fd3875148
Merge: bcc816a 2d9dc9a
Author: Brad King <brad.king at kitware.com>
Date:   Fri Jun 11 16:02:52 2010 -0400

    Merge branch 'vs10-source-groups' into next


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d9dc9ac6560214de280aaab2264812a274aa7ba
commit 2d9dc9ac6560214de280aaab2264812a274aa7ba
Author: Christoph Watzl <christoph.watzl at gmail.com>
Date:   Fri Jun 11 15:33:38 2010 -0400

    Fix nested source groups with VS 10 (#9863)
    
    Add intermediate (but empty) source group filters for the container
    groups.

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 53d6594..59e20d5 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -435,6 +435,9 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
       none.push_back(sf);
       }
     }
+
+  this->AddMissingSourceGroups(groupsUsed, sourceGroups);
+
   // Write out group file
   std::string path =  this->Makefile->GetStartOutputDirectory();
   path += "/";
@@ -492,6 +495,52 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
     }
 }
 
+// Add to groupsUsed empty source groups that have non-empty children.
+void
+cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
+  std::set<cmSourceGroup*>& groupsUsed,
+  const std::vector<cmSourceGroup>& allGroups
+  )
+{
+  for(std::vector<cmSourceGroup>::const_iterator current = allGroups.begin();
+      current != allGroups.end(); ++current)
+    {
+    std::vector<cmSourceGroup> const& children = current->GetGroupChildren();
+    if(children.empty())
+      {
+      continue; // the group is really empty
+      }
+
+    this->AddMissingSourceGroups(groupsUsed, children);
+
+    cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(&(*current));
+    if(groupsUsed.find(current_ptr) != groupsUsed.end())
+      {
+      continue; // group has already been added to set
+      }
+
+    // check if it least one of the group's descendants is not empty
+    // (at least one child must already have been added)
+    std::vector<cmSourceGroup>::const_iterator child_it = children.begin();
+    while(child_it != children.end())
+      {
+      cmSourceGroup* child_ptr = const_cast<cmSourceGroup*>(&(*child_it));
+      if(groupsUsed.find(child_ptr) != groupsUsed.end())
+        {
+        break; // found a child that was already added => add current group too
+        }
+      child_it++;
+      }
+
+    if(child_it == children.end())
+      {
+      continue; // no descendants have source files => ignore this group
+      }
+
+    groupsUsed.insert(current_ptr);
+    }
+}
+
 void
 cmVisualStudio10TargetGenerator::
 WriteGroupSources(const char* name,
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 989db71..64b2361 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -77,6 +77,10 @@ private:
   void WriteGroupSources(const char* name,
                          std::vector<cmSourceFile*> const& sources,
                          std::vector<cmSourceGroup>& );
+  void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed,
+                              const std::vector<cmSourceGroup>& allGroups);
+
+
 private:
   typedef cmVisualStudioGeneratorOptions Options;
   typedef std::map<cmStdString, Options*> OptionsMap;

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

Summary of changes:
 Source/cmVisualStudio10TargetGenerator.cxx |   49 ++++++++++++++++++++++++++++
 Source/cmVisualStudio10TargetGenerator.h   |    4 ++
 2 files changed, 53 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list