MantisBT - CMake
View Issue Details
0010555CMakeCMakepublic2010-04-15 08:112010-06-11 16:05
chrislu 
 
normalmajoralways
closedduplicate 
CMake-2-8 
 
0010555: source_groups not working as expected for Visual Studio 10
file(GLOB SOURCE_FILES ../sick_sad_world/*.cpp)
list(APPEND PROJ_SOURCE_FILES ${SOURCE_FILES})
source_group(source_files/sick_sad_world FILES ${SOURCE_FILES})

when adding files to a source group without any files in the root source file, the source group is missing in Visual Studio 10. there are even some files not visible at all. when inspecting the generated .vcxproj and vcxproj.filters files everything looks normal. so i think this could be an issue of VS10. BUT, when using a native solution/project file it is possible to create such a scenario.

i created a repro case (attached file). when you add the commented part in the CMakeLists.txt file everything works as expected. this part only adds a dummy file to the root source_group.

The problem seems to be the following: The *.filters file generator simply needs to declare a separate filter for those groups that have no files. For example:

# Foo group is empty (i.e. it has no files directly):
source_group( Foo\\Bar FILES main.cpp )

There needs to be the following in the .filters file:

<Filter Include="Foo">
  <UniqueIdentifier>{ %GUID% }</UniqueIdentifier>
</Filter>

In addition to this (which is currently being generated)

<Filter Include="Foo\Bar">
  <UniqueIdentifier>{ %GUID% }</UniqueIdentifier>
</Filter>
No tags attached.
duplicate of 0009863closed Brad King source_groups not (always) working for Visual Studio 10 beta2 
zip sick_sad_world_cmake_vs10.zip (1,042) 2010-04-15 08:11
https://public.kitware.com/Bug/file/3030/sick_sad_world_cmake_vs10.zip
Issue History
2010-04-15 08:11chrisluNew Issue
2010-04-15 08:11chrisluFile Added: sick_sad_world_cmake_vs10.zip
2010-05-08 07:20cbielowNote Added: 0020661
2010-06-11 16:05Brad KingRelationship addedduplicate of 0009863
2010-06-11 16:05Brad KingStatusnew => closed
2010-06-11 16:05Brad KingResolutionopen => duplicate

Notes
(0020661)
cbielow   
2010-05-08 07:20   
identical to
http://www.cmake.org/Bug/view.php?id=10154 [^]
and
http://www.cmake.org/Bug/view.php?id=9863 [^]