title: How to add libraries installed with ExternalProject_Add to target includes
body: <p>I'm trying to include external libraries to a cmake project through <code>ExternalProject_Add</code>.  To try out this feature I've created a minimal working example that involves adding pugixml to the project with <code>ExternalProject_Add</code>. However, I'm having problems finding a way to add the library's header files from the external project's local installation (i.e., pugixml's headers) in the project's include path.</p>
  
  <p>The project tree of the minimal working example is organized as follows:</p>
  
  <pre><code>.
  ├── build
  ├── CMakeLists.txt
  └── src
      ├── CMakeLists.txt
      └── main.cpp
  </code></pre>
  
  <p>In this project tree, <code>build</code> refers to the build directory and the path where cmake is called to generate the build.</p>
  
  <p>The contents of <code>./CMakeLists.txt</code> are as follows:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.0)
  
  include(ExternalProject)
  
  ExternalProject_Add(pugixml
          GIT_REPOSITORY https://github.com/zeux/pugixml.git
          INSTALL_DIR ${PROJECT_BINARY_DIR}/extern_install/pugixml
          CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=&lt;INSTALL_DIR&gt;
  )
  
  add_subdirectory(src)
  </code></pre>
  
  <p>In the above example I've added pugixml as an external project that is to be installed within the project's binary dir, whose file will be used by an executable stored in <code>./src</code>. Thus, the contents of <code>./src/CMakeLists.txt</code> are:</p>
  
  <pre><code>project(foo)
  
  add_executable(foo main.cpp)
  target_link_libraries(foo ${pugixml_LIBRARIES})
  include_directories(${pugixml_INCLUDE_DIR}) # this part doesn't work
  </code></pre>
  
  <p>This is precisely the part I'm having problems.  I've assumed that once the external project was added and installed that <code>ExternalProject_Add</code> would have defined some convenience libraries to help refer to library files and include directories.  However, that doesn't work.  Does anyone know what's the right way of using <code>ExternalProject_Add</code> to include external libraries?</p>