A cookiecutter C++ with modern CMake and conan template, for easy deployment locally.
Setup with a .devcontainer, Github Actions, etc.
Loosely adapted from cpp-best-practices/cmake_conan_boilerplate_template and makes use of aminya/project_options for modern CMake.
First, get Cookiecutter.
$ pip install "cookiecutter>=1.7.0"
Place yourself in the directory where you want your new project to reside.
Now run it against this repo::
$ cookiecutter https://github.com/jmarrec/cookiecutter-cpp-cmake-conan
It will ask for a few questions. The project_slug is going to become your new folder in which the new project files reside.
test_engine
:Catch2
,gtest
orNone
.- If Catch2, option to include
constexpr
tests or not
- If Catch2, option to include
make_cli
CLI: if true, makes a simple CLI with CLI11 and spdlog, otherwise, just a dumb fmt::print statement in main.cppauto_build
isy
, it will automatically create a build folder, call CMake configure, and build. Subsequent options are only valid ify
compiler
:default
, orgcc
orclang
in which case it passesCC=gcc CXX=g++
andCC=clang CXX=clang++
respectivelybuild_type
: passed as-DCMAKE_BUILD_TYPE:STRING=XXX
use_ninja
: ify
it will append-G Ninja
to the configure script
I have configured Dockerfile for my taste (with a subset of my dotfiles) so I have a familiar environment to use. Some images are posted on my Dockerhub, eg jmarrec/cookiecutter-cpp-cmake-conan-gcc11-clang15
- I think there are too many dependencies on small external scripts and actions for my taste, things are likely to break.
- At least for the Github Actions ci.yml, I'd like to remove the dependency on setup-cpp action
- It's failing
- It's opaque
- It currently tries to build too many configurations
- At least for the Github Actions ci.yml, I'd like to remove the dependency on setup-cpp action
- Add (an option to use?) a library (
add_library
) and use that in tests and fuzzing tests.