# Mistake in FetchContent documentation

**URL:** <https://discourse.cmake.org/t/mistake-in-fetchcontent-documentation/5916>\
**Category:** Code\
**Created:** [June 23, 2022, 8:52am UTC](https://discourse.cmake.org/t/mistake-in-fetchcontent-documentation/5916 "2022-06-23T08:52:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![modkin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/modkin/32/2530_2.png) [@modkin](https://discourse.cmake.org/u/modkin)\
**Post date:** [June 23, 2022, 8:52am UTC](https://discourse.cmake.org/t/mistake-in-fetchcontent-documentation/5916/1 "2022-06-23T08:52:37Z")

</div>

Hello everyone,

it seams to me that there is a mistake in the documentation of FetchContent.  
In [Populating Content Without Adding It To The Build](https://cmake.org/cmake/help/git-master/module/FetchContent.html#populating-content-without-adding-it-to-the-build) `FetchContent_MakeAvailable` is used.  
However, it should be `FetchContent_Populate` if I am not mistaken.

Thanks

---

<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:** [June 23, 2022, 11:57am UTC](https://discourse.cmake.org/t/mistake-in-fetchcontent-documentation/5916/2 "2022-06-23T11:57:46Z")

</div>

@craig.scott

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [June 23, 2022, 10:41pm UTC](https://discourse.cmake.org/t/mistake-in-fetchcontent-documentation/5916/3 "2022-06-23T22:41:23Z")

</div>

The example is correct, but I can see how it might be confusing. The last dot point of the `FetchContent_MakeAvailable()` docs states the following:

> - If the top directory of the populated content contains a `CMakeLists.txt` file, call [`add_subdirectory()`](https://cmake.org/cmake/help/git-master/command/add_subdirectory.html#command:add_subdirectory) to add it to the main build. It is not an error for there to be no `CMakeLists.txt` file, which allows the command to be used for dependencies that make downloaded content available at a known location, but which do not need or support being added directly to the build.

So in the example you highlighted, `FetchContent_MakeAvailable()` is being used correctly. The implied assumption in the text of the example is that there won’t be a `CMakeLists.txt` file, but even if there was, it wouldn’t really matter, nor would it change the example. You _could_ use `FetchContent_Populate()` directly, but then you’d also need to include the check whether the content had already been populated (the project might be absorbed into a larger project hierarchy, which would mean there could be a parent that had already brought that dependency into the build). These days, using `FetchContent_Populate()` directly is almost never what you want, except for very specific scenarios where you always want to download. For me, I would never expect that to be the case within a project, only something I’d expect to see in a CMake script executed in script mode.
