diff --git a/circle-mlir/CMakeLists.txt b/circle-mlir/CMakeLists.txt index 677185e9f7c..4b8f65ca12c 100644 --- a/circle-mlir/CMakeLists.txt +++ b/circle-mlir/CMakeLists.txt @@ -23,6 +23,9 @@ endif() # configuration flags include(CfgOptionFlags) +# enable test coverage +include(TestCoverage) + # enable ctest include(CTest) diff --git a/circle-mlir/infra/cmake/TestCoverage.cmake b/circle-mlir/infra/cmake/TestCoverage.cmake new file mode 100644 index 00000000000..8bac6a3bf47 --- /dev/null +++ b/circle-mlir/infra/cmake/TestCoverage.cmake @@ -0,0 +1,5 @@ +add_library(cirmlir_coverage INTERFACE) +if(ENABLE_COVERAGE) + target_compile_options(cirmlir_coverage INTERFACE -g -O0 -fprofile-arcs -ftest-coverage) + target_link_libraries(cirmlir_coverage INTERFACE gcov) +endif()