equal
deleted
inserted
replaced
|
1 find_package (LCOV) |
|
2 |
|
3 # static flags |
|
4 set (TEST_FLAGS --quiet) |
|
5 |
|
6 # add utility targets to run the test_harness executable |
|
7 add_custom_target (test_list |
|
8 COMMAND test_harness ${TEST_FLAGS} --list |
|
9 ) |
|
10 |
|
11 add_custom_target (test |
|
12 COMMAND test_harness ${TEST_FLAGS} |
|
13 ) |
|
14 |
|
15 # add LCOV coverage stuff |
|
16 if (LCOV_FOUND) |
|
17 # static flags |
|
18 set (LCOV_FLAGS --quiet) |
|
19 set (LCOV_GENHTML_FLAGS --quiet) |
|
20 |
|
21 # path to the file generated by `lcov --capture` |
|
22 set (LCOV_CAPTURE_PATH ${CMAKE_CURRENT_BINARY_DIR}/lcov-capture-info) |
|
23 |
|
24 # unless coverage is disabled |
|
25 if (ENABLE_TEST_COVERAGE) |
|
26 # add stuff to the test_run taget |
|
27 add_custom_command (TARGET test PRE_LINK |
|
28 COMMAND ${LCOV_EXECUTABLE} ${LCOV_FLAGS} --directory ${TEST_OBJECT_DIR} --zerocounters |
|
29 ) |
|
30 |
|
31 add_custom_command (TARGET test POST_BUILD |
|
32 COMMAND ${LCOV_EXECUTABLE} ${LCOV_FLAGS} --directory ${TEST_OBJECT_DIR} --capture --output-file ${LCOV_CAPTURE_PATH} |
|
33 COMMAND ${LCOV_GENHTML_EXECUTABLE} ${LCOV_GENHTML_FLAGS} --output-directory ${CMAKE_CURRENT_BINARY_DIR} ${LCOV_CAPTURE_PATH} |
|
34 ) |
|
35 endif (ENABLE_TEST_COVERAGE) |
|
36 endif (LCOV_FOUND) |