<div dir="ltr"><div><div>"Just put all the build commands in the top level cmake file."<br><br></div>Definitely an anti-pattern.  As you mentioned, it definitely doesn't scale.  The problem with even doing this for a simple project is that it builds this behavior for people trying to learn cmake through simple examples.  This very very quickly turns in to a 3k line top level CMakeLists.txt  for even moderately sized projects.  I would really discourage this one as "don't do it ever" because of the bad behaviours it builds early on.<br>

<br></div><div class="gmail_extra">- Chuck<br><br></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 3, 2014 at 1:22 PM, Iosif Neitzke <span dir="ltr"><<a href="mailto:iosif.neitzke+cmake@gmail.com" target="_blank">iosif.neitzke+cmake@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Great to see these examples with pros and cons.<br>
<br>
I believe the staticlibs-include example [0] pattern, though mentioned<br>
in Mastering CMake [1], generally is deprecated in favor of<br>
add_subdirectory with CMakeLists.txt at each level for self-contained<br>
projects.<br>
<br>
[0] <a href="https://github.com/toomuchatonce/cmake-examples/tree/master/staticlibs-include" target="_blank">https://github.com/toomuchatonce/cmake-examples/tree/master/staticlibs-include</a><br>
<br>
[1] Mastering CMake, 6th Edition, Chapter 7: Converting Existing<br>
Systems to CMake, Source Code Directory Structures, page 116<br>
<div><div class="h5"><br>
On Mon, Jun 2, 2014 at 5:23 PM, Adam Boseley <<a href="mailto:adam707blue@gmail.com">adam707blue@gmail.com</a>> wrote:<br>
><br>
> There's a lot of legacy examples around the web but not too many using the<br>
> newer features.  What is the current best practise?<br>
><br>
> Here's some simple examples<br>
> <a href="https://github.com/toomuchatonce/cmake-examples/wiki/cmake-patterns-and-examples" target="_blank">https://github.com/toomuchatonce/cmake-examples/wiki/cmake-patterns-and-examples</a><br>
><br>
> Are these patterns or anti-patterns?<br>
><br>
> Regards,<br>
> Adam<br>
><br>
</div></div>> --<br>
><br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at:<br>
> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Kitware offers various services to support the CMake community. For more<br>
> information on each offering, please visit:<br>
><br>
> CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</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>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</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>
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></div>