Skip to content

Ninja build does not work for coverage target #59

@ahueck

Description

@ahueck

Building TypeART with ninja works but executing the (lcov) coverage targets fails (e.g., lcov-make).

Most likely this behavior comes from differences between make and ninja w.r.t. commands in add_custom_target, see https://gitlab.kitware.com/cmake/cmake/-/issues/21778

The respective targets have to be re-worked for ninja-compat.

Update

Ninja doesn't like the lcov-make target, in particular, both the fragments --no-extenal and -b ${CMAKE_SOURCE_DIR}.
What seems to work is:

add_custom_target(
  lcov-make
  COMMAND ${LCOV_COMMAND} ${GCOV_TOOL} ${GCOV_WORKAROUND} -c -d ${CMAKE_BINARY_DIR} -o typeart.coverage
  COMMAND ${LCOV_COMMAND} --remove typeart.coverage '${CMAKE_BINARY_DIR}/*' -o typeart.coverage
  # need to remove externals:
  COMMAND ${LCOV_COMMAND} --remove typeart.coverage '/usr/*' -o typeart.coverage
  COMMAND ${LCOV_COMMAND} --remove typeart.coverage '*/llvm/*' -o typeart.coverage
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions