Skip to content

alphaolomi/cpp11-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp11-example

Build Status codecov MIT License

Featues

  • C++ version: C++11
  • Build system: CMake
  • C++ compiler: g++
  • Libraries: STL only
  • Code coverage report: lcov (note: it should show the code coverage is below 100%)
  • CodeCov (code coverage is measured by CodeCov).
  • Source: multiple files

Prerequisites

To build the project you need to install CMake. (Install instructions) To display a code coverage report in the console, install lcov. (Download lcov, Instructions)

Guide

  1. Compile with code coverage instrumentation enabled (GCC).
  2. Execute the tests to generate the coverage data.
  3. (Optionally) generate and customize reports with lcov.
  4. Upload to CodeCov using the bash uploader.

Example details

This repo can serve as the starting point for a new project. The following is worth noticing:

  1. Use of a build script instead of putting the commands into .travis.yml
  • Allows local testing
  • Allows usage of set -e to error out with meaningfull messages on any command failure
  1. Separate testing source tree
  • Allows to easily enable/disable testing
  • Allows usage in parent projects (you don't want to build the tests if you are consumed)
  • You may want to exclude coverage of test files which is easier when they are in a separate folder. Remember to use full paths for patterns (like '*/tests/*')
  1. Use of travis cache to cache manually build 3rd-party dependencies (like boost)
  • Speeds up build
  • More can be added (e.g. ccache)
  • Those need to be excluded from coverage info too

Releases

No releases published

Packages

No packages published