[CMake] FetchContent or Export Targets

Jason Beach jason.m.beach at gmail.com
Sat Mar 23 22:43:04 EDT 2019


Hi,
  As I've been learning CMake, it seems the best practice for a library is
for it to export the targets it creates. There is also the relatively new
command FetchContent. It seems that at least in part the FetchContent
command obviates the need for exporting targets.

I can see that for larger more permanent libraries exporting targets is
still preferred so the library can be installed once and used by multiple
projects on a developers workstation without having to install it on each
project.

At work we're a bunch of research engineers that happen to write a lot of
software-- exporting targets still seems cumbersome and it seems not
exporting targets and then just have users use FetchContent to pull in a
library is not a bad idea.

Are there other reasons /advantages of exporting targets?

Thanks,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190323/3f9786f5/attachment.html>


More information about the CMake mailing list