@@ -148,8 +148,6 @@ function(ADD_CODE_COVERAGE)
148
148
add_custom_target (${Coverage_NAME} _cleanup_cpp
149
149
# Cleanup lcov
150
150
COMMAND ${LCOV_PATH} --directory . --zerocounters
151
- # Create baseline to make sure untouched files show up in the report
152
- COMMAND ${LCOV_PATH} -c -i -d . -o ${PROJECT_BINARY_DIR} /${Coverage_NAME} .base
153
151
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
154
152
DEPENDS ${Coverage_DEPENDENCIES}
155
153
COMMENT "Resetting CPP code coverage counters to zero."
@@ -162,13 +160,15 @@ function(ADD_CODE_COVERAGE)
162
160
COMMENT "Resetting PYTHON code coverage counters to zero."
163
161
)
164
162
165
- # Cleanup before we run tests
166
- add_dependencies (_run_tests_ ${PROJECT_NAME} ${Coverage_NAME} _cleanup_cpp)
167
- add_dependencies (_run_tests_ ${PROJECT_NAME} ${Coverage_NAME} _cleanup_py)
163
+ # Cleanup before we run tests (attach to the tests target, which is completed before any test is run)
164
+ add_dependencies (tests ${Coverage_NAME} _cleanup_cpp)
165
+ add_dependencies (tests ${Coverage_NAME} _cleanup_py)
168
166
169
167
# Create C++ coverage report
170
168
add_custom_target (${Coverage_NAME} _cpp
171
169
COMMAND export PYTHONIOENCODING=UTF-8
170
+ # Create baseline to make sure untouched files show up in the report
171
+ COMMAND ${LCOV_PATH} -c -i -d . -o ${PROJECT_BINARY_DIR} /${Coverage_NAME} .base
172
172
# Capturing lcov counters and generating report
173
173
COMMAND ${LCOV_PATH} --directory . --capture --output -file ${PROJECT_BINARY_DIR} /${Coverage_NAME} .info
174
174
# add baseline counters
0 commit comments