[Cmake] Apparent bug in the SOURCE_GROUP command, and a fix

Karr, David David . Karr at titan . com
Wed, 23 Jul 2003 10:13:45 -0400


While trying to use the command

  SOURCE_GROUP("Some Sources" FILES file1.cpp file2.cpp file3.cpp)

the first argument after "FILES" is ignored, so the resulting
group in this example would contain just file2.cpp and file3.cpp.
The bug appears to be due to a line in cmSourceGroupCommand.cxx
that is (approximately) as follows:

   for ( cc =3D 3 ; cc < args.size() ; cc ++ )

Apparently someone forgot (in just one place) that the first
element of args is args[0], not args[1].  The bug appears to be
fixed when I changed the 3 to a 2 in the line of code above.

Meanwhile, a workaround is just to insert a dummy argument
after "FILES", for example:

  SOURCE_GROUP("Some Sources" FILES . file1.cpp file2.cpp file3.cpp)


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