A curated list of awesome CMake scripts, modules, examples and others
Your contributions are highly welcome (first see CONTRIBUTING.md).
- Latest Documentation
- Web Book - CGold: The Hitchhiker’s Guide to the CMake.
- Modern CMake - Modern CMake PDF and samples by the creator of cmakepp.
- Article - Easily supporting CMake install and find_package().
- Article - Easy dependency management for C++ with CMake and Git.
- Article - Opt-in header-only libraries with CMake.
- Article - Ultimate Guide to Modern CMake.
- Article - A list of common CMake antipatterns (from 2013 but still relevant).
- Article - How to Build a CMake-Based Project.
- Article - Learn CMake’s Scripting Language in 15 Minutes.
- Article - The architecture of CMake.
- Lecture - Effective CMake - by Daniel Pfeifer, C++Now 2017.
- Article - Building Cross-Platform CUDA Applications with CMake.
- Tutorial - A step-by-step guide for understanding CMake.
- Article + Lecture - Embracing Modern CMake - by Stephen Kelly.
- Lecture - Modern CMake for Modular Design - by Mathieu Ropert, CppCon 2017.
- Article - Modern C++ CI (although it uses non-modern CMake like
- Article - It’s Time To Do CMake Right (one of the best articles about CMake).
- Articles - A series on CMake - by Martin Hořeňovský
- Lecture - Introduction to CMake - by Florent Castelli, C++ Sweden 2018.
- Article - Some nice and accurate CMake tips.
- Article - Modern CMake for Library Developers.
- Article - Effective Modern CMake: a great summary of most good practices - by Manuel Binna.
- Book - Professional CMake: A Practical Guide (paid).
- Book - Effective CMake: Practical Advice to Write Better CMake (not fully written yet).
- Web Book - An Introduction to Modern CMake.
- YouTube Series - How to CMake Good.
- Lecture - More Modern CMake (slides & examples)- by Deniz Bahadir, Meeting C++ 2018.
- Lecture - Oh No! More Modern CMake (slides)- by Deniz Bahadir, Meeting C++ 2019.
- Article - Modifying the default CMake build types/flags, toolchains and patches - Oh my! - by Cristian Adam.
- Article - Quick CMake Tutorial - from JetBrains - the company behind CLion.
Package Management / Build Systems
- hunter - Cross-platform package manager for C++ (based on CMake ExternalProject).
- cget - CMake package retrieval. This can be used to download and install CMake packages.
- cppan - C++ Archive Network - C++ Package Manager based on CMake, implemented in C++14.
- cpm - C++ Package Manager based on CMake and Git.
- conan - Conan C++ Package Manager, implemented in Python and has a CMake integration backend.
- fips - High-level build system/dependency management for distributed, multi-platform C/C++ projects.
- Ninja - Build system that differs from others in two major respects: it is designed to have its input files generated by a higher-level build system (like CMake), and it is designed to run builds as fast as possible.
- vcpkg - A tool to acquire and build C++ open source libraries. Uses CMake internally as a build script language.
- pmm - PMM is a module for CMake that manages… package managers.
- cpm - A setup-free CMake + git dependency manager.
These provide a wide range of functionality - from dealing with compiler flags to using tools. Some also contain modules.
- dockcross - Cross compiling toolchains in Docker images.
- android-cmake - CMake toolchain file and other scripts for the Android NDK.
- ios-cmake - Toolchain file and examples using CMake for iOS development.
- qt-android-cmake - For building and deploying Qt based apps on Android without QtCreator.
- mingw-w64-cmake - CMake-based MinGW-w64 Cross Toolchain - to build Windows binaries of mpv.
- cmake-avr - CMake toolchain for AVR.
- arduino-cmake - This is the CMake project settings for the Arduino platform.
- polly - Collection of CMake toolchain files and scripts for cross-platform build and CI testing.
- toolchains - For crosscompiling with CMake. They are meant to be mainly used on ArchLinux.
- cmake - Collection of CMake toolchain files, mostly for static linking.
Examples / Templates
- cmake-init - Template for reliable, cross-platform C++ project setup using CMake.
- learning-cmake - This is a simple CMake practice project which contains some different scenarios.
- cmake_test - Small example project using CMake.
- android-cmake - Examples of using ruslo/hunter package manager for an Android application.
- hunter-simple - Example of downloading/installing dependencies using ruslo/hunter package manager.
- weather - Example of using Hunter cross-platform package manager for CMake to build application which use Boost, CppNetlib.URI, GTest, JSON Spirit. Platforms: Windows (Visual Studio), Linux, Mac OS X + iOS.
- package-example - Config mode of find_package (examples for this Stack Overflow question).
- CMakeTemplates - Set of initial CMake templates that I use for every game port I work on.
- minimal_cmake_example - Minimal CMake example, that covers dependencies and packaging.
- cmake-example - Example project which demonstrates various CMake features.
- cmake-examples - Useful CMake examples in a tutorial format.
- cmake-templates - Some CMake Templates. Qt, Boost, OpenCV, C++11, etc.
- CppProjectTemplate - Basic, but working, C++ project using CMake, boost and Doxygen.
- mini-cmake-qt - Minimal CMake template for Qt 5 projects.
- CMake-VisualStudio-Example - CMake example for Visual Studio developers - blog post.
- Cpp-Project-Template - C++ bootstrap project template including CMake build system.
- BASIS - CMake BASIS makes it easy to create sharable software and libraries that work together.
- OpenGL_CMake_Skeleton - A ready to use CMake skeleton using GLFW, Glew and glm.
- coveralls-cmake-example - Example project for coveralls-cmake.
- cppbase - Template for a simple CMake-based C++ project.
- Arduino-CMake-Template - Starting point for Arduino development using CMake.
- c-template - Boilerplate to set up a c project, include CuTest, CMake build setup.
- cpp_project_template - Simple template to start quickly a C++ project managed by CMake.
- cpp-boilerplate - Template that aims to be a reference for modern CMake and CI.
- ci_helloworld - A simple example of how to setup a complete CI environment for C and C++.
- how-to-export-cpp-library - An OS-agnostic template project for exporting either shared, static or header-only C++ library, sporting ctest and CI support, written in plain CMake with line-by-line tutorial comments.
- ModernCppCI - An example of doing a Modern C++ project with CI (although it uses non-modern CMake like
- modern-cmake-sample - Best practices and proper usage of CMake by using targets.
- CMakeInstallExample - Installation example for a C++ project (Windows) with Cmake.
- cpp14-project-template - A C++14 template with CI, tests, code coverage, docs and static analysis integration.
- cmake_templates - Templates for creating C++ libraries and executables (including conan).
- cmake_snippets - Short copy-pasteable CMake snippets.
- cmake-cookbook - A huge CMake cookbook full of recipes.
- cpp-template - A template C++ repository, using CMake and Catch.
- pitchfork - A set of conventions for native C and C++ projects.
- cleanCppProject - A project template using modern CMake, with packaging, tests, docs, static/dynamic analysis, CI.
- cmake-examples - A collection of as simple as possible, modern CMake projects.
- cpp-project - Boiler plate for C++ projects - tests, CI, coverage, docs.
This is released under the
Creative Commons Attribution 4.0 International License
(CC BY 4.0).