diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-03-17 04:37:21 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-03-17 14:32:57 +0000 |
commit | ea7ecd6d3229da0624aaa309f8a5da8a91d77c3e (patch) | |
tree | 1718be85b7c8969f524ae26d79eb4c3f4b463e1c /CMakeLists.txt | |
parent | 571b10149da5a6ee0806109f076666b46d11604b (diff) |
Add COVERAGE cmake flag for clang.
This only works with clang/llvm. Coveralls support needs to be added later.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 20182fbb..1f18988c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -89,6 +89,12 @@ if(NOT MSVC) | |||
89 | add_flag("-Werror") | 89 | add_flag("-Werror") |
90 | endif() | 90 | endif() |
91 | 91 | ||
92 | option(COVERAGE "Track code coverage" OFF) | ||
93 | if(COVERAGE) | ||
94 | add_flag("-fprofile-instr-generate") | ||
95 | add_flag("-fcoverage-mapping") | ||
96 | endif() | ||
97 | |||
92 | option(DEBUG "Enable assertions and other debugging facilities" OFF) | 98 | option(DEBUG "Enable assertions and other debugging facilities" OFF) |
93 | if(DEBUG) | 99 | if(DEBUG) |
94 | set(MIN_LOGGER_LEVEL DEBUG) | 100 | set(MIN_LOGGER_LEVEL DEBUG) |
@@ -457,6 +463,7 @@ function(auto_test target) | |||
457 | if(NOT ARGV1 STREQUAL "DONT_RUN") | 463 | if(NOT ARGV1 STREQUAL "DONT_RUN") |
458 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} auto_${target}_test) | 464 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} auto_${target}_test) |
459 | set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}") | 465 | set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}") |
466 | set_property(TEST ${target} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${target}.profraw") | ||
460 | endif() | 467 | endif() |
461 | endif() | 468 | endif() |
462 | endfunction() | 469 | endfunction() |