[Cmake] Splitting the "Source Files" source group into multiple parts

Karr, David David . Karr at titan . com
Wed, 23 Jul 2003 10:49:41 -0400


I'd like to be able to replace the "Source Files" source group
in a Visual Studio project with multiple non-overlapping source
groups, for example, in my File view I'd like to replace this:

 - Source Files
     Judy1.cpp
     Judy2.cpp
     Miscellaneous.cpp
     Other.cpp
     Punch1.cpp
     Punch2.cpp

with this:

 - Source Files
     Miscellaneous.cpp
     Other.cpp
 - Judy Source Files
     Judy1.cpp
     Judy2.cpp
 - Punch Source Files
     Punch1.cpp
     Punch2.cpp

I can create the new source groups all right, for example

  SOURCE_GROUP("Judy Source Files" FILES Judy1.cpp Judy2.cpp)

but I have not figured out how to remove those files from the
"Source Files" group.

I can easily implementing a new feature such as

  SOURCE_GROUP(group_name CLEAR)

which would remove the regular expression and all file names=20
from the source group (allowing it to be reinitialized by=20
subsequent commands).  Is this a bad idea?


The motivation for splitting up the source group occurs when
I have a library with a large number of files in it (for
example, 100 files).  In that case it's very unwieldy to open
the source group in Visual Studio and try to find the files
you want.  It would be much easier if one divided all the
source files into subgroups according to some classification
so that you could always open a much smaller source group=20
containing whatever file you want.


An obvious workaround would be to leave the "Source Files"=20
group alone, and instead create a new source group, say=20
"Other Source Files", into which I would explicitly place
the remaining subset of source files (that is, all the source
files that I didn't put in "Judy ..." or "Punch ...").
Then all I have to do is train my developers to ignore the=20
"Source Files" group and just use the other (smaller)
source groups.

-- David A. Karr (karr at acm . org)





     =20