The cmake plugin


The cmake plugin is useful for building CMake-based parts.

A cmake project will typically include a CMakeLists.txt file to drive the build, and the plugin requires that CMakeLists.txt exists within the root of the source tree.

This plugin also supports options from the make plugin.

This plugin uses the common plugin keywords as well as those for “sources”. For more information, see Snapcraft parts metadata.

Additionally, this plugin uses the following plugin-specific keywords:

  • configflags (list of strings)
    Configure flags to pass to the build using the common cmake semantics.

For a simple example, see MOOS applications, or search GitHub for projects already using the plugin.

ⓘ This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.


It may be worth noting that cmake-based snaps can fail to build with a “No CMAKE_CXX_COMPILER could be found” error. The solution is to add g++ to the build packages section of the part, like so:

build-packages: [g++]

It may be that g++ should be automatically included when a cmake plugin is used, but that was not the case for me using snapcraft v3.1.