title: cmake use one cmakelist.txt for a project with subdirectories
body: <p>i like to structure my code in multiple subdirs but i dont want to create a new cmakelist.txt in each new subdir.</p>
  
  <p>my folder structure is something like this:</p>
  
  <pre><code>project
    &gt;cmakelist.txt
    &gt;build
    &gt;src
     &gt;main.cpp
     &gt;multiple_subdirs_or_(c|h)pp_files_with_more_subdirs_or_(c|h)pp_files
  </code></pre>
  
  <p>my cmakelist.txt looks like this:</p>
  
  <pre><code>...
  file(GLOB_RECURSE cpps RELATIVE ${CMAKE_CURRENT_LIST_DIR}  "src/*.cpp")
  file(GLOB_RECURSE hpps RELATIVE ${CMAKE_CURRENT_LIST_DIR}  "src/*.hpp")  
  
  #remove files with main
  list(REMOVE_ITEM cpps "src/test.cpp")
  
  #bins
  add_executable(test src/test.cpp src/test.cpp ${hpps} ${cpps})
  
  #same problem if this is used instead of the other add_executable
  add_library(foo OBJECT ${cpps} ${hpps})
  add_executable(test src/test.cpp $&lt;TARGET_OBJECTS:foo&gt;)
  </code></pre>
  
  <p>the problem with my file:</p>
  
  <p>source files created after the execution of cmake are not compiled and the build fails if they are used.
  as predicted by <a href="http://www.cmake.org/cmake/help/v3.0/command/file.html" rel="nofollow">http://www.cmake.org/cmake/help/v3.0/command/file.html</a> in section GLOB: </p>
  
  <blockquote>
    <p>We do not recommend using GLOB to collect a list of source files from
    your source tree. If no CMakeLists.txt file changes when a source is
    added or removed then the generated build system cannot know when to
    ask CMake to regenerate.</p>
  </blockquote>
  
  <p>the question: is it possible to use a single cmakelist.txt for a project with multiple sub directories? (without the problems of file(GLOB ...) )</p>