/cpp-boiler

Primary LanguageCMakeGNU Affero General Public License v3.0AGPL-3.0

'cpp-boiler' A cpp cmake boilerplate project

Travis build Status Appveyor build status Coverage Codacy Badge Language grade: C/C++ CDash dashboard

Pull requests Opened issues Documentation

This is a template for new projects, gives a good CMake base and a few dependencies you most likely want in your project. It also set ups some basic CI builds. It uses "modern" CMake, ie 3.x paradigms, and should be a good starting point for both people willing to learn it and those that want to update/upgrade their CMakeLists.txt ! If you disagree with some pieces of advice given here, please discuss it with me by opening a Github Issue ! Enhancements are always welcome.

Documentation

Documentation

Usage

If you want to bootstrap a new project you only need to :

  • If you don't already have your git repository setup
    • Simply copy/paste the folder (without the .git folder) and run the createBoilerPlate.sh file. This will create an initial git commit and add the required submodules.
  • Hack CMakeLists.txt and CTestConfig.cmake to change the project name
  • Ready to go !

The CI providers used and that might need some setup :

  • Travis CI, for GCC / Clang on Linux/MacOS
  • Codecov.io, for the codecoverage reports
  • CDash, for test and coverage reports using CTest. Can also be used to build nightlies.

Requirements :

  • CMake 3.8.2 (Not needed for all scripts)
  • Git (for the submodules)
  • Any of the CI providers listed above if needed.

Some features/notes :

  • Scripts lying in the support/cmake/ folder can be copy/pasted for use in any CMake project
  • LTO.cmake script : Easier link time optimization configuration (should work on all CMake 3.x versions) as it used to be painful to setup.
  • Warnings.cmake script : A wrapper around common warning settings
  • Basic unit-testing using doctest
  • Coverage.cmake : Test coverage script to add a 'Coverage' build type to CMake
  • The lgtm.com website already knows about cmake and can build most of the projects without any special configuration. A sample configuration is in this project to show how to tag files and disable unneeded warnings. The external folder is automatically recognized and files are tagged as library.