CPM

Download and incudle CPM.cmake

Functions

cpm

Download and include CPM.cmake

cpm([SHALLOW] [PROGRESS] [EXCLUDE_FROM_ALL] [SYSTEM] [TAG <tag>] [REPOSITORY <url>])

Options

SHALLOW

When this option is enabled, the git clone operation will be given the --depth 1 option. This performs a shallow clone, which avoids downloading the whole history and instead retrieves just the commit denoted by the GIT_TAG option.

PROGRESS

When enabled, this option instructs the git clone operation to report its progress by passing it the --progress option. Without this option, the clone step for large projects may appear to make the build stall, since nothing will be logged until the clone operation finishes. While this option can be used to provide progress to prevent the appearance of the build having stalled, it may also make the build overly noisy if lots of external projects are used.

EXCLUDE_FROM_ALL

Added in version 3.28: If the EXCLUDE_FROM_ALL argument is provided, then targets in the subdirectory added by FetchContent_MakeAvailable() will not be included in the ALL target by default, and may be excluded from IDE project files. See the documentation for the directory property EXCLUDE_FROM_ALL for a detailed discussion of the effects.

SYSTEM

Added in version 3.25: If the SYSTEM argument is provided, the SYSTEM directory property of a subdirectory added by FetchContent_MakeAvailable() will be set to true. This will affect non-imported targets created as part of that command. See the SYSTEM target property documentation for a more detailed discussion of the effects.

TAG <tag>

The git tag to download CPM_TAG takes precedence if defined. (v0.42.1 by default).

REPOSITORY <url>

The repository to from where to download CPM.cmake CPM_REPOSITORY takes precedence if defined. (https://github.com/cpm-cmake/CPM.cmake.git by default).

Variables

CPM_REPOSITORY

URL of the CPM repository to download. Takes precedence over the REPOSITORY argument.

CPM_TAG

TAG of the CPM repository to download. Takes precedence over the TAG argument.