This is a template of a cmake C/C++ project configured for unit testing with googletest and code coverage with gcov and lcov.
.
├── CMakeLists.txt
├── inc
│ └── cub.h
├── lib
│ ├── cmake-modules
│ └── googletest
├── README.md
├── src
│ ├── CMakeLists.txt
│ ├── cub.cc
│ └── main.cpp
└── test
├── inc
└── src
├── CMakeLists.txt
└── cub_test.cc
-
The googletest and cmake-modules were added to this repository via git-subtree, so you can easily update these repositories with the following commands:
cd root_of_this_project git subtree pull --squash --prefix=lib/cmake-modules [email protected]:bilke/cmake-modules.git master git subtree pull --squash --prefix=lib/googletest [email protected]:google/googletest.git master
- Unit testing
- Code coverage
-
The code coverage output can be seen by opening the following file in a web browser:
cmake-build-debug/test_coverage/index.html