diff options
author | Brad King <brad.king@kitware.com> | 2013-03-12 17:46:47 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-03-12 17:46:47 (GMT) |
commit | 32fb1f2371d7cfe5ba1952d25182adf55058d812 (patch) | |
tree | cd91a3af12a67ba0fec3a31df7e392e7ce726cf8 /Source | |
parent | 19922ac1d27de2f87082a3a7bbe984cc23f9e0f2 (diff) | |
parent | 545fdec4f8ed705f948080ed203dabc7ab3628d3 (diff) | |
download | CMake-32fb1f2371d7cfe5ba1952d25182adf55058d812.zip CMake-32fb1f2371d7cfe5ba1952d25182adf55058d812.tar.gz CMake-32fb1f2371d7cfe5ba1952d25182adf55058d812.tar.bz2 |
Merge topic 'vs7-empty-groups'
545fdec VS: Avoid empty source groups in some cases (#3474)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 28 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.h | 2 |
2 files changed, 22 insertions, 8 deletions
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); |