MantisBT - CMake
View Issue Details
0011168CMakeCMakepublic2010-08-25 07:452016-06-10 14:31
biocomp 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-8 
 
0011168: vs2010 generator sometimes refuses to add sources to specific source group (marks them as None)
When using complex source file grouping structure like (for example):

Header Files
| Internal
|-| Windows Specific
|-| Posix Specific
Source Files
| Internal
|-| Windows Specific
|-| Posix Specific

source files in .vcxproj.filters are added twice: to ClCompile nodes, but also to None nodes. And thus they're not actually added to source groups and are shown at the project root.
I suppose that else is missing at around line 417 of cmVisualStudio10TargetGenerator.cxx
    
    if(lang[0] == 'C')
      {
      clCompile.push_back(sf);
      }
    if(strcmp(lang, "RC") == 0) // #### ELSE MISSING! ####
      {
      resource.push_back(sf);
      }
    else if(sf->GetCustomCommand())
      {
      customBuild.push_back(sf);
      }
    else if(header)
      {
      headers.push_back(sf);
      }
    else
      {
      none.push_back(sf);
      }
    }

I've tried to add this missing else and it helped. However, I'm too lazy to check that it's really the root of the problem and that this change is only needed here.
No tags attached.
Issue History
2010-08-25 07:45biocompNew Issue
2010-08-31 17:34David ColeStatusnew => assigned
2010-08-31 17:34David ColeAssigned To => Bill Hoffman
2010-11-01 07:41sigmaNote Added: 0022759
2016-06-10 14:28Kitware RobotNote Added: 0041741
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0022759)
sigma   
2010-11-01 07:41   
Apparently, SOURCE_GROUP does not accept generic file types to be added into the solution. For example, if I do:

FILE(GLOB BUILD_SYSTEM_FILES ${BUILD_SYSTEM_PATH}/*.cmake)
SOURCE_GROUP(buildsystem FILES ${BUILD_SYSTEM_FILES} )

the generator does not add the files in "buildsystem" folder into the vs2010 solution. Allowing this would be very useful in larger projects, for instance in my case I maintain a custom build system using cmake files and it would be very convenient to not have to shift from Visual Studio to edit the build system itself.
(0041741)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.