Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.81 KB

README.md

File metadata and controls

65 lines (45 loc) · 1.81 KB

Minimal Modern CMake C++ starter

This is a minimal project starter for modern CMake and C++20. You can just clone/fork this repository and start writing your code.

Table of contents

Introduction

This project defines a simple C++ library and a main executable that uses the library. The project is organized as follows:

  • lib/: Contains the source code of the library.
  • app/: Contains the source code of the main executable.
  • test/: Contains the source code of the tests.

Additionally, dependencies can be imported using the CPM.cmake library. For example, to import the GoogleTest library, you can add the following lines to the CMakeLists.txt file:

include(cmake/CPM.cmake)
CPMAddPackage(
  GITHUB_REPOSITORY google/googletest
  VERSION 1.14.0
  OPTIONS "INSTALL_GTEST OFF" "gtest_force_shared_crt ON"
  EXCLUDE_FROM_ALL
  SYSTEM
)

Compilation

To build the code you can use the following commands:

cmake -S . -B build
cmake --build build

CMake presets (recommended)

You can also use the CMake presets to build the code:

cmake -S . -B build --preset=default
cmake --build build --preset=Release

Acknowledgements

This project is inspired by the following projects:

TODO

  • Add CMake install configuration
  • Generate doxygen documentation