Search code examples
cmakefetchcontent

Official documentation for FetchContent doesn't describe all its options


The official documentation for FetchContent looks more like an overview. I'm looking for a complete reference though. cmake --help-module FetchContent produces the same text as the link above.

In some project I saw this, for example: GIT_SHALLOW TRUE. In this context:

FetchContent_Declare(
    box2d
    GIT_REPOSITORY https://github.com/erincatto/box2d.git
    GIT_TAG 7b273b12409252d247b89940d29a8aab0386f570
    GIT_SHALLOW TRUE
    GIT_PROGRESS TRUE
)

I would like to look up its documentation. There are other thinks for which I couldn't find documentation either.


Solution

  • The official documentation is actually complete. You've probably missed the part

    The <contentOptions> can be any of the download, update, or patch options that the ExternalProject_Add() command understands.

    which refers to the documentation of the ExternalProject_Add command. In that documentation you may find the description of the GIT_SHALLOW option and other git-related options. All these options are applicable for the FetchContent_Declare command, with the same meaning.