Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

run-cmake

> 开发工具
Open source

GitHub Action to build C++ applications with CMake (CMakePresets.json), Ninja and vcpkg on GitHub.

195 stars0 likes2 views
WebsiteGitHub

About

GitHub Action to build C++ applications with CMake (CMakePresets.json), Ninja and vcpkg on GitHub.

  • Quickstart with a C++ project template
  • run-cmake@v10 runs CMake with CMakePresets.json
    • Quickstart with instructions
    • Best practises
      • Usage of github.workspace in multi platform workflows
    • Action reference: all input/output parameters
    • Flowchart
    • Samples
    • Who is using run-cmake
  • License
  • Disclaimer
  • Contributing

Quickstart with a C++ project template

Take a look at this C++ project template that applies all the following instructions, but also shows how to create a pure workflow without using special GitHub action that you cannot run locally on your development machine, but directly using the tools (CMake, Ninja, vcpkg, C++ compilers) you already use daily.

run-cmake@v10 runs CMake with CMakePresets.json

The run-cmake action runs CMake on GitHub workflows leveraging CMakePresets.json. Note that usage of CMakePresets.json is required.

Good companions are the run-vcpkg action and the get-cmake action.

Special features which provide added value over a pure workflow are:

  • annotations for CMake errors/warnings and for build (gcc/msvc/clang) errors/warnings are created inline in the changed source files the build run for, e.g.:

  • when necessary, it sets up the environment to build with the MSVC toolset.

  • automatic dump of log files created by CMake (e.g., CMakeOutput.log) and vcpkg. The content of those files flow into the workflow output log. The regex is customizable by the user.

The provided samples use GitHub hosted runners.

Good companions are the run-vcpkg action and the get-cmake action.

Quickstart with instructions

It is highly recommended to use:

  • a vcpkg.json manifest file to declaratively specify the dependencies.
  • the required CMakePresets.json file.
  • vcpkg as a submodule of your repository.
…

Best practises

Usage of github.workspace in multi platform workflows

Using github.workspace may be challenging since it contains backslashes on Windows which are interpreted as escape sequences when used as base path of additional arguments. To work around this, you could use the String.raw function which prevents the escape sequences from being processed, e.g.:

yaml
  with:
    configurePresetAdditionalArgs: "[ String.raw`-DD3D9_INCLUDE_DIR=${{ github.workspace }}/cache/Include` ]"

Action reference: all input/output parameters

Description of all input parameters: action.yml

Flowchart

Flowchart with related input in action.yml which let customize the flow.

…

If you want vcpkg env to avoid adding tool paths to PATH, provide a custom runVcpkgEnvFormatString without --tools, for example:

yaml
runVcpkgEnvFormatString: "[`env`, `--bin`, `--include`, `--python`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `set`]"

Samples

Checkmarks indicates whether the samples "uses" or specifies the thing in the header or whether it is true.

workflow link vcpkg as submodule explicit triplet vcpkg toolchain CMake's Presets Ninja run-vcpkg runs vcpkg CMake runs vcpkg
link ✅ ❌ ✅ ✅ ✅ ❌ ✅
link ❌ ❌ ✅ ✅ ✅ ❌ ✅
link ❌ ❌ ✅ ✅ ✅ ✅ ❌
link ✅ ✅ ✅ ✅ ✅ ❌ ✅

Who is using run-cmake

This graph shows the list of public repositories with more than 25 stars using run-cmake.

License

All the content in this repository is licensed under the MIT License.

Copyright © 2019-2020-2021-2022-2023-2024-2025 Luca Cappa

Disclaimer

The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the source code with fixes and new features.

Contributing

Read CONTRIBUTING.md

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptcmakecpluspluscppgit

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具