mirror of
https://github.com/XRPLF/rippled.git
synced 2026-02-07 07:25:26 +00:00
This change adds `cmake-format` as. a pre-commit hook. The style file closely matches that in Clio, and they will be made to be equivalent over time. For now, some files have been excluded, as those need some manual adjustments, which will be done in future changes.
53 lines
1.3 KiB
CMake
53 lines
1.3 KiB
CMake
#[===================================================================[
|
|
coverage report target
|
|
#]===================================================================]
|
|
|
|
if (NOT coverage)
|
|
message(FATAL_ERROR "Code coverage not enabled! Aborting ...")
|
|
endif ()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
message(WARNING "Code coverage on Windows is not supported, ignoring 'coverage' flag")
|
|
return()
|
|
endif ()
|
|
|
|
include(ProcessorCount)
|
|
ProcessorCount(PROCESSOR_COUNT)
|
|
|
|
include(CodeCoverage)
|
|
|
|
# The instructions for these commands come from the `CodeCoverage` module, which was copied from
|
|
# https://github.com/bilke/cmake-modules, commit fb7d2a3, then locally changed (see CHANGES: section in
|
|
# `CodeCoverage.cmake`)
|
|
|
|
set(GCOVR_ADDITIONAL_ARGS ${coverage_extra_args})
|
|
if (NOT GCOVR_ADDITIONAL_ARGS STREQUAL "")
|
|
separate_arguments(GCOVR_ADDITIONAL_ARGS)
|
|
endif ()
|
|
|
|
list(APPEND
|
|
GCOVR_ADDITIONAL_ARGS
|
|
--exclude-throw-branches
|
|
--exclude-noncode-lines
|
|
--exclude-unreachable-branches
|
|
-s
|
|
-j
|
|
${PROCESSOR_COUNT})
|
|
|
|
setup_target_for_coverage_gcovr(
|
|
NAME
|
|
coverage
|
|
FORMAT
|
|
${coverage_format}
|
|
EXCLUDE
|
|
"src/test"
|
|
"src/tests"
|
|
"include/xrpl/beast/test"
|
|
"include/xrpl/beast/unit_test"
|
|
"${CMAKE_BINARY_DIR}/pb-xrpl.libpb"
|
|
DEPENDENCIES
|
|
xrpld
|
|
xrpl.tests)
|
|
|
|
add_code_coverage_to_target(opts INTERFACE)
|