Skip to content

jwlawson/actions-setup-cmake

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Setup cmake for GitHub Actions

Github action to setup the cmake build script generator.

This action will update the path for your workflow to include cmake matching the platform and version requirements.

Usage

Adding a step that uses this action to your workflow will setup cmake and make it available to subsequent steps:

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
    - name: Setup cmake
      uses: jwlawson/actions-setup-cmake@v2
      with:
        cmake-version: '3.16.x'
    - name: Use cmake
      run: cmake --version

Options

There are three options for the action:

  • cmake-version controls the version of CMake that is added to the path. This can be a fully specified verison 3.3.0, partly specified 3.2, a wildcard version 3.2.x. By default it is empty which will give the latest CMake version available on GitHub.

    The version can also be specified to be latest which is equivalent to leaving it blank and will give the latest version.

    The version tests show some expected values for given versions.

  • github-api-token is optional, but is used to authenticate with GitHub's API. By default it will use the token generated by the workflow. If set to blank then no authentication is used to access the API and there is a chance that the test runner will have hit the API rate limit causing the action to fail to download the available versions from GitHub.

    See also:

  • use-32bit forces the use of a 32 bit binary, instead of first looking for a 64 bit binary. Note that more recent releases of cmake only have 32 bit packages for windows and not for linux or macos, so this option may cause failures in those cases.

    Possible values are true or false. The default is false.

How it works

The action will download the list of releases of CMake available on GitHub and choose the best match for the test runner's platform and the version requirements given as as option. The CMake package is then either downloaded from GitHub, or a cached version from the action's tool cache is used, and the executables are provided on the path for subsequent workflow steps.