CTest/Coverage/Example
From KitwarePublic
< CTest/Coverage
Jump to navigationJump to search
Revision as of 01:53, 3 January 2012 by Daviddoria (talk | contribs) (Created page with "==coverage.cpp== <source lang="cpp"> #include <iostream> int main (int, char *[]) { std::cout << "Sample text." << std::endl; return 0; } </source> ==CMakeLists.txt== <...")
coverage.cpp
<source lang="cpp">
- include <iostream>
int main (int, char *[]) {
std::cout << "Sample text." << std::endl;
return 0;
}
</source>
CMakeLists.txt
<source lang="cmake"> cmake_minimum_required(VERSION 2.6)
project(Coverage) ENABLE_TESTING()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")
SET(CXXFLAGS="-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(CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage") SET(LDFLAGS="-fprofile-arcs -ftest-coverage")
add_executable(Coverage coverage.cpp) target_link_libraries(Coverage gcov)
</source>