title: Include headers with a library in CMake
body: <p>My project has two utility library in it. I am looking for the best way to write CMake configurations for the libraries.</p>
  
  <pre><code>/my_project
   --&gt; CMakeLists.txt
   --&gt; main.cpp
   --&gt; /utils
        --&gt; CMakeLists.txt
        --&gt; common.h
        --&gt; /base_c
             --&gt; CMakeLists.txt
             --&gt; base_c.c
             --&gt; base_c.h
        --&gt; /base_cpp
             --&gt; CMakeLists.txt
             --&gt; base_cpp.cpp
             --&gt; base_cpp.hpp
  </code></pre>
  
  <p>My current CMake files:</p>
  
  <p>/my_project/CMakeLists.txt</p>
  
  <pre><code>cmake_minimum_requared(VERSION 3.8)
  project(my_project)
  
  add_subdirectory(utils)
  
  add_executable(main main.c)
  target_link_libraries(main utils base_c base_cpp)
  </code></pre>
  
  <p>/my_project/utils/CMakeLists.txt</p>
  
  <pre><code>add_subdirectory(base_c)
  add_subdirectory(base_cpp)
  
  add_library(utils)
  target_sources(utils PUBLIC common.h)
  </code></pre>
  
  <p>/my_project/utils/base_c/CMakeLists.txt</p>
  
  <pre><code>add_library(base_c base_c.c)
  target_sources(base_c PUBLIC base_c.h)
  </code></pre>
  
  <p>/my_project/utils/base_cpp/CMakeLists.txt</p>
  
  <pre><code>add_library(base_cpp base_cpp.cpp)
  target_sources(base_cpp PUBLIC base_cpp.hpp)
  
  find_library(BASEC base_c ../base_c)
  target_link_libraries(base_cpp BASEC)
  </code></pre>
  
  <p>The problem is that <code>base_cpp</code> does not find includes from <code>base_c</code>. How should I fix the configuration?</p>
  
  <p>I managed to make it work with <code>target_include_directories(base_cpp PRIVATE ../base_c)</code>, but that's ugly and shouldn't be necessary, according to <a href="https://cmake.org/cmake/help/v3.0/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES.html#interface-include-directories" rel="noreferrer">INTERFACE_INCLUDE_DIRECTORIES documentation</a>.</p>