<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---------- Forwarded message ----------<br>From: Robert Dailey <<a href="mailto:rcdailey.lists@gmail.com">rcdailey.lists@gmail.com</a>><br>To: CMake <<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>><br>Cc: <br>Date: Sun, 16 Aug 2015 08:32:08 -0500<br>Subject: [CMake] How to depend on external cmake projects?<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There are certain repositories on Github I'd like to pull in as a<br>
dependency. These repositories already use CMake to build their source<br>
code. Based on personal experience and reading material online, there<br>
are a couple of different options:<br></blockquote><div><br></div><div>In addition to the options you listed (omitted here), since the projects you want to pull in are CMake-based, another choice is to simply add them to your project directly via add_subdirectory(). This can be convenient for linking against the 3rd party libraries, etc. since CMake will already know about the 3rd party targets and CMake will also build them with the same settings as the rest of your build. If you want, you can use ExternalProject to download the source code at configure time, a technique I recently mentioned on this list. You can find the article about that approach (with Google Test as the example) here:</div><div><br></div><div><a href="http://crascit.com/2015/07/25/cmake-gtest/">http://crascit.com/2015/07/25/cmake-gtest/</a><br></div><div><br></div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Craig Scott<br>Melbourne, Australia</div><div><a href="http://crascit.com" target="_blank">http://crascit.com</a></div></div></div>
</div></div>