[cmake-developers] [CMake 0013425]: source_group displays empty groups (when nesting)

Mantis Bug Tracker mantis at public.kitware.com
Thu Jul 19 07:51:25 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13425 
====================================================================== 
Reported By:                SParis
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13425
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-07-19 07:51 EDT
Last Modified:              2012-07-19 07:51 EDT
====================================================================== 
Summary:                    source_group displays empty groups (when nesting)
Description: 
Issue applicable for Visual Studio projects.

When using source_group to define nested groups with some files, those groups
are displayed even if they do not contain files for a given target.

In my case, I have two targets, with source_groups defined for target#1 and
containing some files. Those files being referenced as sources for target#1,
they are displayed correctly and classified in the good group.
But, those files not being part of target#2, the groups are still displayed in
the Visual Studio project (but the most nested group).

Even if this issue is non-blocking, it is a pain in my case where I classify
lots of sources in groups for several targets in the same project. It results
with a lot of noisy empty groups in all of my projects.

Steps to Reproduce: 
Just put the following wherever in your CMakeLists.txt, and build using a Visual
Studio generator (the files do not have to be referenced).

source_group(test FILES test)
source_group(test\\test1 FILES test1)
source_group(test\\test1\\test2 FILES test2)

As a result, you will see the following empty project folders for your target:
|-test
| |-test1

Additional Information: 
I assume that there is a bug in the CMake source code when checking if a group
must be displayed or not: the group is tested to be empty, but accounting for
sub-groups as well without recursing through them to check if themselves are
empty as well. That would explain why the hierarchy of empty groups does not
display the last empty group (this one not having any file nor sub-group).
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-07-19 07:51 SParis         New Issue                                    
======================================================================




More information about the cmake-developers mailing list