---
source: https://iinventedlight.com/library/notes/cmake-fetchcontent.md
title: "Populate a CMake dependency at configure time with FetchContent"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (CMake docs); BSD-3-Clause (CMake docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: CMake docs, FetchContent; CMake docs, cmake-packages(7). BSD-3-Clause; BSD-3-Clause."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: CMake FetchContent"
tags: [cmake, fetchcontent, dependencies, configure]
client: Librarian
sources:
  - id: S1
    title: "FetchContent"
    publisher: CMake docs
    url: https://cmake.org/cmake/help/latest/module/FetchContent.html
    accessed: 2026-11-19
    license: "BSD-3-Clause"
  - id: S2
    title: "cmake-packages(7)"
    publisher: CMake docs
    url: https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/cmake-packages.7.rst
    accessed: 2026-11-19
    license: "BSD-3-Clause"
---
# Populate a CMake dependency at configure time with FetchContent
**Answer:** This module provides commands to populate content at configure time. Load this module in CMake with `include(FetchContent)`. It was added in 3.11. `ExternalProject_Add` downloads at build time. `FetchContent` instead makes content available immediately, so configure can call `add_subdirectory`, `include`, or `file`.

## Declare, then make available

Content population details should be defined separately from the command that performs the actual population. Call `FetchContent_Declare` first. Then call `FetchContent_MakeAvailable`. That command ensures the named dependencies have been populated. It uses an earlier call when one exists, or it populates them itself. During that population step, the command also adds the dependencies to the main build when it can.

The first details to be declared for a given dependency take precedence. The first call that tries to populate a dependency wins.

| FetchContent_Declare | FetchContent_MakeAvailable |
|---|---|
| declare content details | populate named dependencies |
| before population | after `FetchContent_Declare` |
| `include(FetchContent)` | `include(FetchContent)` |

## Packages and find_package

Packages provide dependency information to CMake based buildsystems. Packages are found with the `find_package` command. The result of using `find_package` is either a set of `IMPORTED` targets, or a set of variables. `FetchContent` populates content at configure time. `find_package` finds packages that are already provided.

## See also

- [cmake-presets](https://iinventedlight.com/library/notes/cmake-presets/)
- [cmake-install-export](https://iinventedlight.com/library/notes/cmake-install-export/)

## Claims

- id: C1
  claim: FetchContent populates content at configure time, unlike ExternalProject_Add which downloads at build time.
  source: S1
  evidence: "Whereas :command:`ExternalProject_Add` downloads at build time"

- id: C2
  claim: FetchContent_MakeAvailable populates named dependencies and can add them to the main build.
  source: S1
  evidence: "The :command:`FetchContent_MakeAvailable` command ensures the named"

- id: C3
  claim: Installed or provided packages are found with the find_package command.
  source: S2
  evidence: "Packages are found with the :command:`find_package` command."

## Sources

- [S1] FetchContent. CMake docs. https://cmake.org/cmake/help/latest/module/FetchContent.html . License: BSD-3-Clause. Accessed 2026-11-19.

- [S2] cmake-packages(7). CMake docs. https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/cmake-packages.7.rst . License: BSD-3-Clause. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: CMake docs, FetchContent; CMake docs, cmake-packages(7). BSD-3-Clause; BSD-3-Clause. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
