title: How to tell CMake to download external projects before compiling my sources
body: <p>I have my own code which depends on third-party libraries, such as yaml-cpp for example. I want to download these third-party libraries before compiling my own sources. However, I don't manage to do it with CMake.</p>
  
  <p>I managed to download yaml-cpp like this:</p>
  
  <pre><code>ExternalProject_Add(yaml-cpp
                  URL https://yaml-cpp.googlecode.com/files/yaml-cpp-0.5.1.tar.gz
                  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/yaml-cpp
                  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=&lt;INSTALL_DIR&gt;
  </code></pre>
  
  <p>But when I type</p>
  
  <pre><code>cmake ..
  make
  </code></pre>
  
  <p>my sources are compiled before. Actually, yaml-cpp is downloaded at the very last step.</p>
  
  <p>Do you know how to tell CMake to download third-party libraries at the very first building step?</p>
  
  <p>Thanks!</p>