rapids_cpm_init¶
Added in version v21.06.00.
Establish the CPM and preset package infrastructure for the project.
rapids_cpm_init( [CUSTOM_DEFAULT_VERSION_FILE <json_default_file_path>]
[OVERRIDE <json_override_file_path>]
[GENERATE_PINNED_VERSIONS]
)
The CPM module will be downloaded based on the state of CPM_SOURCE_CACHE
and
ENV{CPM_SOURCE_CACHE}
. This allows multiple nested projects to share the
same download of CPM. If those variables aren’t set the file will be cached
in the build tree of the calling project
Added in version v24.06.00: `
CUSTOM_DEFAULT_VERSION_FILE
`
This is an advanced option that allows projects to specify a custom default versions.json
file that will
be used instead of the one packaged inside rapids-cmake. Since this allows you to specify a new default
versions.json
it must contain information for all the built-in rapids-cmake packages ( cccl, fmt, rmm, etc )
that are used by your project.
Using a built-in rapids-cmake package without an explicit entry in the custom default version file is undefined behavior.
If multiple calls to rapids_cpm_init
occur with different default version files being used,
each version file will be loaded. If a project is listed in multiple default version files, the first
file values will be used, and all later calls for that packaged will be ignored. This “first to record, wins”
approach is used to match FetchContent
, and allows parent projects to override child
projects.
The provided json file must follow the versions.json
format, which is documented here.
If the variable RAPIDS_CMAKE_CPM_DEFAULT_VERSION_FILE
is specified it will be used
in all calls to rapids_cpm_init
instead of any explicit CUSTOM_DEFAULT_VERSION_FILE file, or
usage of the rapids-cmake default version.json file.
Added in version v21.10.00: OVERRIDE
Allows projects to override the default values for any rapids_cpm_find()
,
rapids_cpm_*, CPM,
and FetchContent()
package. By providing a secondary
file with extra`CPM` preset package information for the project.
If multiple calls to rapids_cpm_init
occur with different OVERRIDE
files being used,
each version file will be loaded. If a project is listed in multiple override files, the first
file values will be used, and all later calls for that packaged will be ignored. This “first to record, wins”
approach is used to match FetchContent
, and allows parent projects to override child
projects.
The provided json file must follow the versions.json format, which is documented here.
If the override file doesn’t specify a value or package entry the default version will be used.
Added in version v24.06.00.
If the variable RAPIDS_CMAKE_CPM_OVERRIDE_VERSION_FILE
is specified it will be used
in all calls to rapids_cpm_init
. Any existing explicit OVERRIDE files will be ignored, and
all other calls will be treated as if this file was specified as the override.
Added in version v24.04.00: `
GENERATE_PINNED_VERSIONS
`
Generates a json file with all CPM dependencies with pinned version values.
This allows for reproducible builds using the exact same state.
The pinning file will be located at <CMAKE_BINARY_DIR>/rapids-cmake/pinned_versions.json
Added in version v24.06.00.
If the variable RAPIDS_CMAKE_CPM_PINNED_VERSIONS_FILE
exists it will be treated
as if all calls to rapids_cpm_init
are requesting generation of a pinned versions file.
In addition to any existing explicit GENERATE_PINNED_VERSIONS files, the file path contained
in RAPIDS_CMAKE_CPM_PINNED_VERSIONS_FILE
will be used as a destination to
write the pinned versions.json content.
Note
Must be called before any invocation of rapids_cpm_find()
.