View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003474CMakeCMakepublic2006-07-03 08:522013-10-07 10:03
ReporterMalte Clasen 
Assigned ToBrad King 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0003474: SOURCE_GROUP creates empty groups when using multiple projects
DescriptionGiven the following CMakeLists.txt,

--------------------
SOURCE_GROUP("a1\\a2" "a.cpp")
PROJECT("a")
ADD_LIBRARY("a" STATIC "a.cpp")

SOURCE_GROUP("b1\\b2" "b.cpp")
PROJECT("b")
ADD_LIBRARY("b" STATIC "b.cpp")
--------------------

CMake creates the following project/group hierarchy for Visual C++ 8:

--------------------
a/a1/a2/a.cpp
a/b1
b/a1
b/b1/b2/b.cpp
--------------------

Those groups that contain another group are mirrored into the other project although they are empty in that context.
TagsNo tags attached.
Attached Filespatch file icon source_group_targets_dos.patch [^] (10,328 bytes) 2009-05-28 21:19 [Show Content]
patch file icon writeGroups.patch [^] (2,679 bytes) 2013-02-04 04:54 [Show Content]

 Relationships

  Notes
(0012812)
pixman20 (reporter)
2008-07-23 20:07
edited on: 2008-07-23 20:09

Can we expect this bug to be fixed in the next version of CMake since it appears that the ticket was submitted over 2 years ago? I am using CMake 2.6 and it is still mirroring the subfolders.

(0016071)
Mikael Hedberg (reporter)
2009-04-19 10:06

I'm also interested in the status of a fix for this bug.
(0016588)
Jacob Repp (reporter)
2009-05-28 21:24

I've attached a patch (with dos line endings) that addresses this issue on the 2.6.4 source release. I ran into this while converting our build system to cmake. This patch adds an optional parameter to source_group which is TARGET. After TARGET you specify the name of the target that the source group exists in. The reason this is done is because source group definitions can exist for multiple targets (even recursively) due to the way that source groups are handled by cmake. This provides you with the most control and flexibility when defining your source groups. The behavior of source groups is not altered when the TARGET parameter is not used.

Example:
SOURCE_GROUP(a1\\a2 TARGET a FILES a.cpp)
PROJECT(a)
ADD_LIBRARY(a STATIC a.cpp)

SOURCE_GROUP(b1\\b2 TARGET b FILES b.cpp)
PROJECT(b)
ADD_LIBRARY(b STATIC b.cpp)
(0017132)
Amit (reporter)
2009-08-14 10:16

I'm interested in a fix of this bug.
(0027316)
Pjotr Svetachov (reporter)
2011-09-01 05:25

We also ran into this bug and while it is just a minor annoyance a fix would be nice.
(0031199)
Graham Menhennitt (reporter)
2012-10-10 01:39

Yes, please fix this. It's very annoying.

Thanks
(0032143)
mika rajala (reporter)
2013-01-24 01:52

6 years later and no fix?

I'm supposed to try and "sell" cmake usage to my teammates today and this bug is bound to come up.

Please fix this!
(0032190)
Anton Helwart (reporter)
2013-02-04 05:02

Hi,

I wrote a small patch (writeGroups.patch) to fix this problem in the Visual Studio 7 generator.
It makes the WriteGroup methode return true, if a group or any of its
children have source files.
The children write their output to a temporay cmOStringStream and its only
added to the real output, if it is not empty.
I hope the patch can be of some use.

Regards, Anton
(0032540)
Brad King (manager)
2013-03-08 10:28

Re 0003474:0032190: Thanks for the patch. Applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=545fdec4 [^]

It appears this problem does not occur in the VS 10 and 11 generators, so I'm resolving this issue.
(0033985)
Robert Maynard (manager)
2013-10-07 10:03

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2008-07-23 20:07 pixman20 Note Added: 0012812
2008-07-23 20:09 pixman20 Note Edited: 0012812
2009-04-19 10:06 Mikael Hedberg Note Added: 0016071
2009-05-28 21:19 Jacob Repp File Added: source_group_targets_dos.patch
2009-05-28 21:24 Jacob Repp Note Added: 0016588
2009-08-14 10:16 Amit Note Added: 0017132
2009-08-14 10:16 Amit Note Added: 0017133
2009-08-14 10:16 Amit Note Deleted: 0017133
2011-09-01 05:25 Pjotr Svetachov Note Added: 0027316
2012-10-10 01:39 Graham Menhennitt Note Added: 0031199
2013-01-24 01:52 mika rajala Note Added: 0032143
2013-02-04 04:54 Anton Helwart File Added: writeGroups.patch
2013-02-04 05:02 Anton Helwart Note Added: 0032190
2013-03-08 10:28 Brad King Note Added: 0032540
2013-03-08 10:28 Brad King Assigned To Bill Hoffman => Brad King
2013-03-08 10:28 Brad King Status assigned => resolved
2013-03-08 10:28 Brad King Resolution open => fixed
2013-03-08 10:28 Brad King Fixed in Version => CMake 2.8.11
2013-03-08 10:28 Brad King Target Version => CMake 2.8.11
2013-10-07 10:03 Robert Maynard Note Added: 0033985
2013-10-07 10:03 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team