title: CMake and VisualStudio: Group files in solution explorer
body: <p>To finish a long coding session on a project, I wanted to test if my CPP project is compilable on an arrangement of OS'es.</p>
  
  <p>I've been working in Win10 all the time. Compiles fine.<br>
  I've tried a Raspberry Pi. Compiles fine.
  I re-download a seperate copy of my project to a Win10 client, run cmake-gui, and open the project: My folder structure in the solution explorer all gone.</p>
  
  <p>So I started digging around, and apparently this structure is kept in CMakeLists.txt with the command <code>source_group</code>. So I start adding more source_groupings to my cmake lists, and for some reason my groupings won't take.</p>
  
  <p>Example:<br>
  <code>source_group("game\\entitysystem" FILES ${entitysystem_SRC}) // Existing grouping
  source_group("game\\entitysystem\\components" FILES ${components_SRC}) // My new grouping</code></p>
  
  <p>My glob would be this:</p>
  
  <p><code>file(GLOB components_SRC
      "game/components/*.h"
      "game/components/*.cpp"
      )</code></p>
  
  <p><code>file(GLOB entitysystem_SRC
      "game/entitysystem/*.h"
      "game/entitysystem/*.cpp"
      )</code></p>
  
  <p>I do believe my GLOB's are correct since the new project-clone compiles fine. It's just that every part of the new structure in Visual Studio's Solution Explorer seems lost. Yes, I have cleared Cmake's cache and regenerated the project. Doesn't change it.</p>
  
  <p>Original structure:
  <a href="https://i.stack.imgur.com/EznO4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EznO4.png" alt="Original folder structure"></a></p>
  
  <p>Cloned project structure:
  <a href="https://i.stack.imgur.com/gVqqF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gVqqF.png" alt="Cloned folder structure"></a></p>
  
  <p>Edit:</p>
  
  <p>I did make a mistake in my source_group as in that it should not put components beneath entitysystem, but still, why aren't there any filters created in Visual Studio?</p>