/Cpp-Project-Template

🏗️ A C++ project template built with Docker, Makefile, CMake, GoogleTest and GitHub Actions.

Primary LanguageCMake

C++ Project Template

C++ CMake Docker Linux

Introduction

A C++ project template built with:

Building without Docker

Prerequisites

  • Install GoogleTest.
  • Install CMake.

Building

Set the location to the project folder and run:

mkdir build
cd build
cmake ..
cmake --build .

Running Tests

Set the location to the build folder and run:

ctest -VV

Running the Main Program

Set the location to the build/bin folder and run:

./cpp-sample

Building with Docker

Prerequisites

  • Install Docker.

Building

Set the location to the project folder and run:

docker image build . -t <image>

<image> should be replaced with a custom Docker image name.

Running Tests

docker container run <image> ctest --test-dir .. -VV

Running the Main Program

docker container run <image>

Structure

.
├── .github
│   └── workflows
│       └── build-test.yaml
├── cmake
│   └── hello.cmake
├── docs
│   └── badges
│       ├── C++.svg
│       ├── Linux.svg
│       ├── Made-with-CMake.svg
│       └── Made-with-Docker.svg
├── include
│   └── foo
│       └── foo.h
├── src
│   ├── foo
│   │   ├── CMakeLists.txt
│   │   ├── foo.cpp
│   │   ├── private_foo_test.cpp
│   │   ├── private_foo.cpp
│   │   └── private_foo.h
│   ├── CMakeLists.txt
│   └── main.cpp
├── tests
│   ├── CMakeLists.txt
│   └── foo_test.cpp
├── .clang-format
├── .gitignore
├── CITATION.cff
├── CMakeLists.txt
├── Dockerfile
└── README.md