Setup CMake

Set up a specific version of a CMake compiler and add it to the PATH.

This action will also set-up any dependencies required by CMake.

In most workflows, this is used as an auxiliary action for the CMake Workflow action, which already calls this action if necessary.

Input Parameters

Parameter

Description

Default

version

Version range or exact version of CMake to use, using SemVer’s version range syntax.

Reads from cmake-file input if unset.

By default, it uses any version available in the environment.

>=3.0.2

architecture

The target architecture (x86, x64). By default, this value is inferred.

cmake-file

File containing the CMake version to use in a cmake_minimum_required command.

Example: A CMakeLists.txt file containing a call to cmake_minimum_required.".

CMakeLists.txt

path

Path to the cmake executable. The action attempts to find cmake at this path first.

cmake

cmake-path

The cmake executable. We attempt to find cmake at this path first.

This option is available for backwards compatibility and has priority over path.

cache

Used to specify whether the CMake installation should be cached in the case CMake needs to be downloaded.

As binaries are provided for all versions of CMake, this option is deprecated and will be removed in a future release.

true

check-latest

By default, when CMake is not available, this action will install the minimum version in the version spec. This ensures the code respects its contract in terms of what minimum CMake version is supported.

Set this option if you want the action to check for the latest available version that satisfies the version spec instead.

false

update-environment

Set this option if you want the action to update environment variables.

true

trace-commands

Trace commands executed by the workflow.

false

Outputs

Output

Description

path

The absolute path to the CMake executable.

dir

The absolute path to the CMake directory.

version

The installed CMake version. Useful when given a version range as input.

version-major

The installed CMake version major. Useful when given a version range as input.

version-minor

The installed CMake version minor. Useful when given a version range as input.

version-patch

The installed CMake version patch. Useful when given a version range as input.

cache-hit

A boolean value to indicate a cache entry was found

supports-path-to-build

Whether CMake supports the -B <path-to-build> syntax

supports-parallel-build

Whether CMake supports the -j <threads> syntax

supports-build-multiple-targets

Whether CMake supports the --target with multiple targets

supports-cmake-install

Whether CMake supports the cmake --install