Template for C++ library built with CMake
Template repository to be used as a base for creating C++ libraries built with CMake. This repository provides:
cmake
for CMake utilities and package config, include/<libname>
for public headers, src
for library sources and private headers, examples
and tests
for library examples and tests correspondingly.CMakeLists.txt
files thoroughly implemented with the following ideas in mind:
CMakeLists.txt
file should contain only build requirements, i.e. should not hardcode any compiler/linker flags unless they are absolutely required to build the libraryCMakePresets.json
which is a modern way (since CMake 3.19) for specifying build options (instead of hardcoding them in the CMakeLists.txt
or setting on the command line).clang-format
for code-style worth tryingNote, that I prefer googletest as a testing framework so it's the one used in this repository. Still it's not a big deal to replace it with any other of your choice.