# ExternalProject\_Add when only build external libs and when build-install

**URL:** <https://discourse.cmake.org/t/externalproject-add-when-only-build-external-libs-and-when-build-install/2434>\
**Category:** Code\
**Created:** [December 28, 2020, 9:18pm UTC](https://discourse.cmake.org/t/externalproject-add-when-only-build-external-libs-and-when-build-install/2434 "2020-12-28T21:18:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerim](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/6f9a4e/32.png) [@kerim](https://discourse.cmake.org/u/kerim)\
**Post date:** [December 28, 2020, 9:18pm UTC](https://discourse.cmake.org/t/externalproject-add-when-only-build-external-libs-and-when-build-install/2434/1 "2020-12-28T21:18:25Z")

</div>

Hi,

`ExternalProject_Add` allows build and install libraries.  
I experiment with it and as an example I use [Slicer 3D](https://www.slicer.org/). I can see that Slicer builds some libs and other libs Slicer builds-install.

What is the logic behind that? When usually developpers use `ExternalProject_Add` to simply build and when to build-install libraries?

As for me I’m trying understand do I need to build or build-install Eigen3 (header only) via `ExternalProject_Add`?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [January 4, 2021, 7:00pm UTC](https://discourse.cmake.org/t/externalproject-add-when-only-build-external-libs-and-when-build-install/2434/2 "2021-01-04T19:00:17Z")

</div>

The general rule of thumb is that projects should either be all-ExternalProject or no ExternalProject. Mixing just leads to sadness down the road.

@jcfr do you have insight into the current state of Slicer 3D’s usage of ExternalProject?

Cc: @craig.scott

---

<div class="post-metadata">

**Author:** ![kerim](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/6f9a4e/32.png) [@kerim](https://discourse.cmake.org/u/kerim)\
**Post date:** [January 5, 2021, 3:27am UTC](https://discourse.cmake.org/t/externalproject-add-when-only-build-external-libs-and-when-build-install/2434/3 "2021-01-05T03:27:43Z")

</div>

Thank you for the rule of thumb, I didn’t know about that.

> [@ben.boeckel](#):
>
> do you have insight into the current state of Slicer 3D’s usage of ExternalProject?

Slicer is a big project but I think I have some understanding how Slicer works and uses External projects (usually with `find_package()` function).

In the picture below you can see build folder of Slicer’s external projects. You can see that some libs are installed and other are simly built:

 ![image](https://discourse.cmake.org/uploads/default/original/2X/5/5b36c098608730bb4eb5c874134da82a4256d4fd.png)

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [January 5, 2021, 1:43pm UTC](https://discourse.cmake.org/t/externalproject-add-when-only-build-external-libs-and-when-build-install/2434/4 "2021-01-05T13:43:55Z")

</div>

I don’t know what makes `DCMTK` so different. I suspect that might be because it uses a shared install directory somewhere, but I think Slicer developers are better positioned to answer.
