title: How to set Visual Studio Filters for nested sub directory using cmake
body: <p>I have following structure</p>
  
  <pre><code>Main (dir)
        +-- CMakeLists.txt
        +-- File.cpp
        +-- File.hpp
        +-- Dir (dir)
            +-- CMakeLists.txt
            +-- File1.cpp
            +-- File1.hpp
            +-- File2.cpp
            +-- File2.hpp
  </code></pre>
  
  <p><strong>Main/CMakeLists.txt</strong></p>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED (VERSION 2.8.11)
  PROJECT(Main)
  FILE(GLOB SOURCE
      "*.hpp"
      "*.cpp"
  )
  
  ADD_SUBDIRECTORY(Dir)
  ADD_EXECUTABLE(Main ${SOURCE})
  </code></pre>
  
  <p><strong>Main/Dir/CmakeLists.txt</strong></p>
  
  <pre><code>FILE(GLOB LOCAL_SOURCE
      "*.hpp"
      "*.cpp"
  )
  SET(SOURCE
      ${SOURCE}
      ${LOCAL_SOURCE}
      PARENT_SCOPE
  )
  </code></pre>
  
  <p>It generated the following structure in Visual Studio<br>
  <img src="https://i.stack.imgur.com/OrC1B.jpg" alt="enter image description here"></p>
  
  <p><strong>What I want:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/XSA3w.jpg" alt="enter image description here">  <img src="https://i.stack.imgur.com/h7PgM.jpg" alt="enter image description here"></p>
  
  <p><strong>What I tried:</strong>  </p>
  
  <p><em>Main/CMakeLists.txt</em>  </p>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED (VERSION 2.8.11)
  PROJECT(Main)
  FILE(GLOB LOCAL_SOURCE
      "*.hpp"
      "*.cpp"
  )
  
  SET(SOURCE 
      ${LOCAL_SOURCE}
  )
  
  ADD_SUBDIRECTORY(Dir)
  
  SOURCE_GROUP(Main FILES ${LOCAL_SOURCE})
  ADD_EXECUTABLE(Main ${SOURCE})
  </code></pre>
  
  <p><em>Main/Dir/CmakeLists.txt</em></p>
  
  <pre><code>FILE(GLOB LOCAL_SOURCE
      "*.hpp"
      "*.cpp"
  )
  SET(SOURCE
      ${SOURCE}
      ${LOCAL_SOURCE}
      PARENT_SCOPE
  )
  
  SOURCE_GROUP(Dir FILES ${LOCAL_SOURCE})
  </code></pre>
  
  <p><strong>What I get:</strong> </p>
  
  <p><img src="https://i.stack.imgur.com/YeYAQ.jpg" alt="enter image description here"></p>
  
  <p>Please help me regarding this.</p>
  
  <ul>
  <li>I do not want to use single CmakeFile.txt in Main directory having filters</li>
  <li>Actual structure is many layers deep nesting structure. So please suggest the solution which will work for any level sub directory</li>
  </ul>