cmake.star¶
Bump CMake's minimum version and FetchContent dependency tags.
Edits are line-based, so comments and formatting in CMakeLists.txt stay as they were.
load("@fleet//cmake.star", "files", "minimum_version", "set_minimum_version", "set_fetchcontent_tag")
| Function | What it does |
|---|---|
files |
Lists the repo's CMake files. |
minimum_version |
Reads the version from cmake_minimum_required. |
set_minimum_version |
Raises cmake_minimum_required to a version, never lowering it. |
set_fetchcontent_tag |
Sets the GIT_TAG of a FetchContent_Declare dependency. |
files¶
Lists the repo's CMake files.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The sorted paths of every CMakeLists.txt and *.cmake file outside build directories.
Example
minimum_version¶
Reads the version from cmake_minimum_required.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
path |
The CMake file to read. |
Returns: The minimum version, such as 3.16, or None.
Example
set_minimum_version¶
Raises cmake_minimum_required to a version, never lowering it.
A ...max policy range, such as 3.16...3.28, keeps its upper end.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
version |
The new minimum, such as 3.20. |
Returns: The list of paths that changed.
Example
Used in: cmake-minimum
set_fetchcontent_tag¶
Sets the GIT_TAG of a FetchContent_Declare dependency.
A newer version already there is kept, so a campaign never lowers one.
The declaration may span several lines. Declarations of other names,
and ones without a GIT_TAG, are left alone.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
name |
The dependency's name, the first argument of FetchContent_Declare. |
tag |
The new tag or commit. |
Returns: The list of paths that changed.
Example
Used in: cmake-minimum