Skip to content

Commit 2c1aba4

Browse files
doyubkimutilForever
authored andcommitted
Make code coverage build optional (#216)
1 parent 5be277d commit 2c1aba4

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ include(cmake/CompileOptions.cmake)
4646

4747
# Code coverage - Debug only
4848
# NOTE: Code coverage results with an optimized (non-Debug) build may be misleading
49-
if (CMAKE_BUILD_TYPE MATCHES Debug AND CMAKE_COMPILER_IS_GNUCXX)
49+
option(BUILD_COVERAGE "Build code coverage" OFF)
50+
if (CMAKE_BUILD_TYPE MATCHES Debug AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_COVERAGE)
5051
include(CodeCoverage)
5152
setup_target_for_coverage(${PROJECT_NAME}_coverage unit_tests coverage)
5253
endif()

scripts/travis_build_codecov.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sudo apt-get install -yq lcov curl
88

99
mkdir build
1010
cd build
11-
cmake .. -DCMAKE_BUILD_TYPE=Debug
11+
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_COVERAGE=ON
1212
make unit_tests
1313
lcov -c -i -d src/tests/unit_tests -o base.info
1414
bin/unit_tests

0 commit comments

Comments
 (0)