A modern boilerplate for C++ project, built on Cmake, Conan with Catch and spdlog.
Now you are browsing the v2 branch! See differences below
- Download this project:
git clone --recursive https://github.com/htfy96/cpp-boilerplate.git - Change
examplein filenames/namespaces undersrc/,test/intoyour_project - Change
CMakeLists.txt:example->your_project - Change
.travis.yml:example->your_project - Change
README.md:cpp-boilerplate->your_project - Enable Travis-CI at https://travis-ci.org
- Push & Enjoy it!
mkdir -p build cd build conan -s build_type=Debug --build=missing -s compiler.stdlib=libstdc++11 .. # For alternative compiler configuration: # conan -s build_type=Debug -s compiler.stdlib=libstdc++11 --build=missing \ # -s compiler=gcc -s compiler.version=6 .. # OR # Use Conan configurations (https://docs.conan.io/en/latest/getting_started.html#building-with-other-configurations) # and specify with conan -pr PATH .. cmake -Dexample-build_tests=ON \ -DCMAKE_BUILD_TYPE=debug .. # For alternative compiler: # cmake -Dexample-build_tests=ON \ # -DCMAKE_BUILD_TYPE=RelWithDebInfo \ # -DCMAKE_C_COMPILER=gcc-6 \ # -DCMAKE_CXX_COMPILER=g++-6 \ # .. make clangformat # to format your files make -j4 ctest # run tests Options can be defined with cmake ... -DOPTION_KEY=OPTION_VALUE
| Key | Possible Values | Effect |
|---|---|---|
USE_GOLD_LINKER | ON/OFF | Use GNU gold linker instead of ld. Only effect if gold is found. |
INCREMENT_LINK | ON/OFF | Use gold linker's --incremental flag to speed up relink speed. Effective only when USE_GOLD_LINKER is specified. Note that this may disable many security protections like relto or PIE. Only use this when working on Really large project. |
example-build_tests | ON/OFF | Build test or not |
CMAKE_BUILD_TYPE | Debug/Release/RelWithDebInfo | Build type |
- v2 is based on Ubuntu 18.04
- v2 uses Conan instead of git submodule to manage dependencies
- v2 uses g++-6/7 and clang++-6, while master uses g++-4.9/5 and clang++-3.8
- v2 enforces minimal CMake version = 3.9, while master only enforces 3.1
- v2 includes clang-tidy as an enforced check