#!/usr/bin/env bash

srcdir=@PROJECT_SOURCE_DIR@
builddir=@PROJECT_BINARY_DIR@

# path to the toolchain-specific harness. Configured by either
# xo_toplevel_coverage_config2 (standalone satellite build) or
# xo_umbrella_coverage_config (umbrella build). Resolves to one of:
#   xo-cmake-lcov-harness      (gcov toolchain)
#   xo-cmake-llvmcov-harness   (llvm toolchain)
covharness=@XO_CMAKE_COV_HARNESS_EXECUTABLE@

if [[ -z $covharness ]]; then
   echo "gen-ccov: coverage harness (XO_CMAKE_COV_HARNESS_EXECUTABLE) not configured"
   echo "gen-ccov: should be set by xo_umbrella_coverage_config or xo_toplevel_coverage_config2"
   exit 1
fi

$covharness $srcdir $builddir
