Difference between revisions of "CTest/Coverage/Example"

From KitwarePublic
Jump to navigationJump to search
(Replace content with link to new CMake community wiki)
Line 1: Line 1:
<source lang="cpp">
#include <iostream>

int main (int, char *[])
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/ctest/coverage/Example here].
  std::cout << "Sample text." << std::endl;
  return 0;
<source lang="cmake">
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_CXX_FLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
#SET(CMAKE_SHARED_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")
add_executable(Coverage coverage.cpp)
target_link_libraries(Coverage gcov)
add_test(NAME Coverage COMMAND Coverage)

Latest revision as of 15:41, 30 April 2018

The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.