title: Making all projects in CMake Visual Studio depend on one project
body: <p>In my project, I have about 250 projects with one main project that uses most of the projects. It's important that all projects are up to date when the main project is run. So basically, Visual Studio should check for all 250 projects for changes when MainProject is compiled (and run). My CMakeLists.txt files look like this.</p>
  
  <p><strong>Root/CMakeLists.txt</strong></p>
  
  <pre><code>....
  add_subdirectory (MainProject)
  add_subdirectory (ProjectA)
  add_subdirectory (ProjectB)
  add_subdirectory (ProjectC)
  add_subdirectory (ProjectD)
  ....
  </code></pre>
  
  <p><strong>Root/MainProject/CMakeLists.txt</strong></p>
  
  <pre><code>....
  add_executable (MainProject a.cpp b.cpp)
  add_dependencies (MainProject ProjectA ProjectB ...)
  ....
  </code></pre>
  
  <p><strong>Root/ProjectA/CMakeLists.txt</strong></p>
  
  <pre><code>....
  add_executable (ProjectA a.cpp b.cpp)
  ....
  </code></pre>
  
  <p>Obviously this is a very simplified example, but hopefully the idea is there. Basically, in order to make Visual Studio to check for dependencies for all 250 projects or so, I have to add all the other projects in the main project as dependencies. Now this is not an elegant solution at all, as add_dependencies in MainProject has a LOT of dependencies in it. It works, but is there anything more elegant for this problem?</p>