# Relationship between FetchContent and ExternalProject

**URL:** https://discourse.cmake.org/t/relationship-between-fetchcontent-and-externalproject/10162
**Category:** Usage
**Created:** [February 22, 2024, 10:31pm UTC](https://discourse.cmake.org/t/relationship-between-fetchcontent-and-externalproject/10162 "2024-02-22T22:31:56Z")
**Posts on this page:** 1
**Showing post:** 6

<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: [February 27, 2024, 7:14pm UTC](https://discourse.cmake.org/t/relationship-between-fetchcontent-and-externalproject/10162/6 "2024-02-27T19:14:10Z")

</div>

> [@dabrahams](#):
>
> In what way don’t they mix well?

The files for `find_package(dep)` when using `ExternalProject_add(dep)` won’t exist until build time. So you cannot use `find_package(dep)` to load your dependency.

> [@dabrahams](#):
>
> making a project that builds my project and all of its dependencies as external seems very inconvenient for day-to-day development work on my project, because IIUC in the super-project, rebuilds of my project would not be triggered by changes to its source files

There are techniques for actual development. Look for `DEVELOPER_MODE` in our [`common-superbuild`](https://gitlab.kitware.com/paraview/common-superbuild/). What this does is build all of the _dependencies_ of the specific project and provides a `developer-mode.cmake` script that can be used to pass as `-C developer-mode.cmake` to configure an arbitrary build tree as if it were in the superbuild (namely finding dependencies).

> [@dabrahams](#):
>
> Also, can you confirm my general conclusion that the top-level project always needs to be in control over satisfying all of the transitive dependencies of everything that’s built? That seems like the only way dependency diamonds can ever be resolved reliably when there are version constraints. Have I got that right?

Yes. Vendoring without offering controls to “unvendor” is a wonderful way to make packagers’ lives hell because somebody else is going to want that dep someday too. If a superbuild is not suitable, it might be that you can document a list of Conan or vcpkg packages that are needed and use those environments to provide dependencies.

---

_[View the full topic](https://discourse.cmake.org/t/relationship-between-fetchcontent-and-externalproject/10162)._
