title: Directory Structure for Library CMake Projects
body: <p>I've an Application project <code>Demo</code> which depends on my Shared library <code>Hello</code>. Library <code>Hello</code>  should be redistributable. So I need to distribute the headers of Hello as well as use it in my Demo projects. What directory structure and CMake configuration should I use ? I previously had a flat structure and <code>Hello</code> was a header only subdirectory with no CMakeLists.txt. Now I am planning this directory structure.</p>
  
  <pre><code>Demo
      main.cpp
      app.h
      app.cpp
      CMakeLists.txt
      Hello
         includes
             matrix.hpp          // header only
             diagonal.hpp
             point.hpp
             store.h
             analyzer.h
         sources
             store.cpp
             alanyzer.cpp
         CMakeLists.txt
  </code></pre>
  
  <p>Previously the analyzer was header-only which is now splited in header and source. I am mixing header-only things. Is this a good structure ? But I prefer to use the nice <code>#include &lt;Hallo/matrix.hpp&gt;</code> not the ugly one <code>#include "Hallo/includes/matrix.hpp"</code> or just <code>#include "matrix.hpp"</code>. I expect this library <code>Hello</code> will be used for other applications and libraries as well. </p>
  
  <p><code>Demo/CMakeList.txt</code></p>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  PROJECT(Demo)
  ADD_SUBDIRECTORY(Demo)
  
  SET(Demo_HEADERS
    app.h
  )
  
  SET(Demo_SOURCES
    app.cpp
    main.cpp
  )
  
  INCLUDE_DIRECTORIES(${Hello_INCLUDE_DIRS})
  # ^^^^ Is this how I need to access the headers ? or just ADD_SUBDIRECTORY() will work
  
  ADD_EXECUTABLE(Demo ${Demo_SOURCES} ${Demo_HEADERS})
  
  TARGET_LINK_LIBRARIES(Demo Hello)
  </code></pre>
  
  <p>Hello/CMakeLists.txt</p>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  PROJECT(Hello)
  
  FIND_PACKAGE(Boost COMPONENTS filesystem program_options thread system serialization date_time chrono REQUIRED)
  
  INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
  
  SET(Hello_SOURCES
    store.cpp
    analyzer.cpp
  )
  
  INCLUDE_DIRECTORIES((${HELLO_SOURCE_DIR}/includes)
  # ^^^^ Is this how I need to access the headers ?
  
  ADD_LIBRARY(Hello ${Hello_SOURCES})
  
  TARGET_LINK_LIBRARIES(Hello ${Boost_LIBRARIES})
  </code></pre>
  
  <p>I am kind of confused with all this as there is no one specific way to do these all.</p>
  
  <p>--- EDIT ---</p>
  
  <p>Should I have this structure ? or Do some other libraries generally use this structure ? or what are the structures generally practiced ?</p>
  
  <pre><code>hallo
    includes
      hallo
    sources 
  </code></pre>