[CMake] How to depend on external cmake projects?

Craig Scott audiofanatic at gmail.com
Sun Aug 16 17:56:14 EDT 2015


> ---------- Forwarded message ----------
> From: Robert Dailey <rcdailey.lists at gmail.com>
> To: CMake <cmake at cmake.org>
> Cc:
> Date: Sun, 16 Aug 2015 08:32:08 -0500
> Subject: [CMake] How to depend on external cmake projects?
>


> There are certain repositories on Github I'd like to pull in as a
> dependency. These repositories already use CMake to build their source
> code. Based on personal experience and reading material online, there
> are a couple of different options:
>

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:

http://crascit.com/2015/07/25/cmake-gtest/


-- 
Craig Scott
Melbourne, Australia
http://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150817/7c85130e/attachment.html>


More information about the CMake mailing list