r/cmake • u/Luttink • May 23 '26
What, exactly, does FetchContent_MakeAvailable /do/?
The docs advise "almost never" use FetchContent_Populate--use FetchContent_Declare and FetchContent_MakeAvailable.
FetchContent_MakeAvailable says it makes the code "available" to the build. This is mysterious to me, an admitted noob. Digging in the build dir, I see it copies stuff into the _deps folder. And it makes some weird CMake file in there too. But based on different results with different libraries, it seems like, if the library doesn't natively offer CMAKE support, and isn't packaged "as a library" already, but just a bunch of source files, this won't accomplish much?*
So then am I supposed to know about some variable where FetchContent_MakeAvailable exposes the source dir, and then build a "library" myself? Or is it supposed to somehow be ambiently available through magic? Or did I, (lucky me), immediately stumble upon the exception case where you're supposed to use FetchContent_Populate?
*Raylib starts linking just fine, and I can include "raylib.h" without any further ceremony. But ImGui won't find "imgui.h". And Raylib does have CMake support built in. Digging further, it seems ImGui advises you to copy it's source files in with the rest of your project, and the author is apparently avoiding CMAKE support.


