title: CMake subdirectories dependency
body: <p>I am very new to CMake. In fact, I am trying it through Kdevelop4 widh C++.</p>
  
  <p>I have the habit of creating subdirs for every namespace I create, even if all the sources must be compiled and linked into a single executable. Well, when i create a directory under kdevelop, it updates CMakeLists.txt with a add_subdirectory command and creates a new CMakeLists.txt under it, but that alone does not add the sources under it to the compilation list.</p>
  
  <p>I have the root CMakeLists.txt as follows:</p>
  
  <pre>
  
  project(gear2d)
  
  add_executable(gear2d object.cc main.cc)
  
  add_subdirectory(component)
  </pre>
  
  <p>Under component/ I have the sources I want to be compiled and linked to produce the gear2d executables. How can I accomplish that?</p>
  
  <p>CMake FAQ have <a href="http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_add_a_dependency_to_a_source_file_which_is_generated_in_a_subdirectory.3F" rel="noreferrer">this</a> entry but if thats the answer I'd rather stay with plain Makefiles.</p>
  
  <p>Is there a way of doing this?</p>