<div dir="ltr">They are two different things entirely.<div><br></div><div style>add_subdirectory is used when you have a project structured hierarchically in directories and subdirectories, but you want the entire project configured at one time.</div>
<div style><br></div><div style>ExternalProject is used to download, configure and build a project that is a prerequisite to your project, but not part of your project.</div><div style><br></div><div style>The most common use-case is the SuperBuild pattern.  In this case all prerequisites to your project are built, and then YOUR project is built as an ExternalProject.  Why? Because almost always, the prerequisites need to be built and perhaps installed BEFORE configuring your projects.</div>
<div style><br></div><div style>It is sometimes possible to use ExternalProject from within your source tree, but it requires that configuring your project requires nothing from the ExternalProject at configure time.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 4, 2013 at 2:23 AM, Ansis Māliņš <span dir="ltr">&lt;<a href="mailto:ansis.malins@gmail.com" target="_blank">ansis.malins@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If I have a dependency (e.g. SDL2) that seems to work with add_subdirectory just fine, should I still use ExternalProject_Add instead? Given both ways work, what should I prefer? What are the tradeoffs?</div>


<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>