title: CMake How to set src root directory so that always finding header files from root directory instead of relative path?
body: <p>I have an issue about including header file.</p>
  
  <p><strong>Error Message</strong></p>
  
  <pre><code>In file included from /path/to/src/main.cpp:1:
  /path/to/src/dirA/testA.h:1:10: fatal error: 'common/util.h' file not found
  #include "common/util.h"
  </code></pre>
  
  <p><strong>directory</strong></p>
  
  <pre><code>├── dirA
  │   └── testA.h
  ├── common
  │   └── util.h
  └── main.cpp
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include "dirA/testA.h"
  
  int main()
  {}
  </code></pre>
  
  <p><strong>testA.h</strong></p>
  
  <pre><code>#include "common/util.h" // &lt;--- Here is the error point
  </code></pre>
  
  <p><strong>CMakeLists.txt</strong></p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  
  add_definitions("-std=c++11") 
  
  add_executable(main
    main.cpp
  )
  </code></pre>
  
  <p>I found that the following way is fine but I don't want to think the file path relation.</p>
  
  <pre><code>#include "../common/util.h"
  </code></pre>
  
  <hr>
  
  <p>Update 1</p>
  
  <p>Thanks to Mark Farrugia's answer, the build error was solved. However, I like "common/util.h" better than "util.h" since the path is easy to understand. And it might to avoid duplicated definitions.</p>
  
  <p><strong>testA.h</strong></p>
  
  <pre><code>#include "util.h"
  </code></pre>
  
  <p><strong>CMakeLists.txt</strong></p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  
  add_definitions("-std=c++11") 
  
  include_directories("common")
  
  add_executable(main
    main.cpp
  )
  </code></pre>