[Cmake-commits] CMake branch, next, updated. v2.8.10.2-2422-gaf17507

Brad King brad.king at kitware.com
Fri Mar 8 10:26:08 EST 2013


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  af175072356115cb9e845f5cbddf242de68b6ef2 (commit)
       via  545fdec4f8ed705f948080ed203dabc7ab3628d3 (commit)
      from  6549dc029e5e7a9ff6dc4134573eaa03bf8f1f70 (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=af175072356115cb9e845f5cbddf242de68b6ef2
commit af175072356115cb9e845f5cbddf242de68b6ef2
Merge: 6549dc0 545fdec
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Mar 8 10:26:01 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 8 10:26:01 2013 -0500

    Merge topic 'vs7-empty-groups' into next
    
    545fdec VS: Avoid empty source groups in some cases (#3474)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=545fdec4f8ed705f948080ed203dabc7ab3628d3
commit 545fdec4f8ed705f948080ed203dabc7ab3628d3
Author:     Anton Helwart <sidtrun at gmail.com>
AuthorDate: Mon Feb 4 10:35:48 2013 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Mar 8 08:27:12 2013 -0500

    VS: Avoid empty source groups in some cases (#3474)
    
    Teach the WriteGroup method return true if a group or any of its
    children have source files.  Have children write their output to a
    temporay cmOStringStream.  Add it to the real output only if not empty.

diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index f07ebef..dfe8280 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1621,17 +1621,30 @@ cmLocalVisualStudio7Generator
   return dir_max;
 }
 
-void cmLocalVisualStudio7Generator
+bool cmLocalVisualStudio7Generator
 ::WriteGroup(const cmSourceGroup *sg, cmTarget& target,
              std::ostream &fout, const char *libName,
              std::vector<std::string> *configs)
 {
   const std::vector<const cmSourceFile *> &sourceFiles =
     sg->GetSourceFiles();
+  std::vector<cmSourceGroup> const& children  = sg->GetGroupChildren();
+
+  // Write the children to temporary output.
+  bool hasChildrenWithSources = false;
+  cmOStringStream tmpOut;
+  for(unsigned int i=0;i<children.size();++i)
+    {
+    if(this->WriteGroup(&children[i], target, tmpOut, libName, configs))
+      {
+      hasChildrenWithSources = true;
+      }
+    }
+
   // If the group is empty, don't write it at all.
-  if(sourceFiles.empty() && sg->GetGroupChildren().empty())
+  if(sourceFiles.empty() && !hasChildrenWithSources)
     {
-    return;
+    return false;
     }
 
   // If the group has a name, write the header.
@@ -1752,11 +1765,10 @@ void cmLocalVisualStudio7Generator
       }
     }
 
-  std::vector<cmSourceGroup> const& children  = sg->GetGroupChildren();
-
-  for(unsigned int i=0;i<children.size();++i)
+  // If the group has children with source files, write the children.
+  if(hasChildrenWithSources)
     {
-    this->WriteGroup(&children[i], target, fout, libName, configs);
+    fout << tmpOut.str();
     }
 
   // If the group has a name, write the footer.
@@ -1764,6 +1776,8 @@ void cmLocalVisualStudio7Generator
     {
     this->WriteVCProjEndGroup(fout);
     }
+
+  return true;
 }
 
 void cmLocalVisualStudio7Generator::
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 5a1d208..d9e2ef0 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -109,7 +109,7 @@ private:
                        FCInfo& fcinfo);
   void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
 
-  void WriteGroup(const cmSourceGroup *sg,
+  bool WriteGroup(const cmSourceGroup *sg,
                   cmTarget& target, std::ostream &fout,
                   const char *libName, std::vector<std::string> *configs);
 

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

Summary of changes:
 Source/cmLocalVisualStudio7Generator.cxx |   28 +++++++++++++++++++++-------
 Source/cmLocalVisualStudio7Generator.h   |    2 +-
 2 files changed, 22 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list