title: CMake and handling subfolder header files
body: <p>I'm trying to set up my project to build several dynamic libraries that encompass its complete functionality.  There are subfolders for each library.  The subfolder libraries are dependent on each other, so they must reference functions from each other.  I seem to have managed to get CMake to run without errors on the project, but when I go to build, I have trouble with my headers finding each other.  It seems at build time, the include path isn't set up correctly.  How can I fix this?  Are there additional steps I need to take to set up the include path correctly?</p>
  
  <p>The structure looks something like this</p>
  
  <pre><code>root
      CMakeLists.txt
      bin
      lib
      lib0
          CMakeLists.txt
          lib0.h
          lib0.cpp
      lib1
          CMakeLists.txt
          lib1.h
          lib1.cpp
      ...
  </code></pre>
  
  <p>In the CMakeLists.txt for the root directory I have declarations like this:</p>
  
  <pre><code>set(ROOT /blah/blah/root)    
  
  include_directories(${ROOT}/lib0)
  include_directories(${ROOT}/lib1)
  
  add_subdirectory(lib0)
  add_subdirectory(lib1)
  </code></pre>
  
  <p>In the CMakeLists.txt for the subfolders, I have:</p>
  
  <pre><code>set(lib0_SOURCES "")
  list(APPEND lib0_SOURCES lib0.cpp)
  add_library(lib0_lib ${lib0_SOURCES})
  </code></pre>
  
  <p>And my headers for the libraries look like (suppose this is lib0.h):</p>
  
  <pre><code>#include "lib1/lib1.h"
  ...
  </code></pre>
  
  <p>CMake runs fine with no errors, but when I go to compile, I get an error like:</p>
  
  <pre><code>In file included from /blah/blah/root/lib0/lib0.cpp:1:0:
  /blah/blah/root/lib0/lib0.h:1:30: fatal error: lib1/lib1.h: No such file or directory
  </code></pre>