back to home

ttroy50 / cmake-examples

Useful CMake Examples

13,068 stars
2,546 forks
31 issues
CMakeC++Shell

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing ttroy50/cmake-examples in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind-ai.vercel.app/repo/ttroy50/cmake-examples)
Preview:Analyzed by RepoMind

Repository Summary (README)

Preview

= CMake Examples :toc: :toc-placement!:

toc::[]

Introduction

https://cmake.org/[CMake] is a cross-platform open-source meta-build system which can build, test and package software. It can be used to support multiple native build environments including make, Apple's xcode and Microsoft Visual Studio.

This repository includes some example modern CMake configurations which I have picked up when exploring it's usage for various projects. The examples are laid out in a tutorial like format. The first examples are very basic and slowly increase in complexity drawing on previous examples to show more complex use cases.

These examples have been tested on Ubuntu 16.04 but should work under any Linux system that supports CMake v3.5+.

This branch works with the CMake version 3.5 onwards.

image:https://travis-ci.org/ttroy50/cmake-examples.svg?branch=master["Build Status", link="https://travis-ci.org/ttroy50/cmake-examples"]

Requirements

The basic requirements for most examples are:

  • CMake v3.5+
  • A c++ compiler (defaults to gcc)
  • make

Installation on Ubuntu

The easiest way to install the above on Ubuntu is as follows

[source,bash]

$ sudo apt-get install build-essential $ sudo apt-get install cmake

Some specific examples may require other tools including:

Docker

Docker containers with all requirements and various versions of CMake are generated to help make testing the examples easier. These are available from the docker hub repository link:https://hub.docker.com/r/matrim/cmake-examples/[matrim/cmake-examples].

To build the full set of cmake-examples test cases you can run:

[source,bash]

docker run -it matrim/cmake-examples:3.5.1 cd ~ git clone https://github.com/ttroy50/cmake-examples.git code cd code ./test.sh

For more details on build and running the docker containers link:here[dockerfiles].

Other Links

There are many CMake tutorials and examples online. The list below includes links to some of these which I have found helpful in my CMake journey.