From 3de3b1414aaba68c0bea1791f61e69d887d17934 Mon Sep 17 00:00:00 2001 From: Henry Yu Date: Sun, 7 Jul 2024 22:59:45 -0700 Subject: [PATCH] build: add coverage instrumentation option --- llvm/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index dfe81ad0e2ee35..69022d4ff02b46 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -48,6 +48,11 @@ project(LLVM VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH} LANGUAGES C CXX ASM) +if (COVERAGE) + add_compile_options(--coverage) + add_link_options(--coverage) +endif() + if (NOT DEFINED CMAKE_INSTALL_LIBDIR AND DEFINED LLVM_LIBDIR_SUFFIX) # Must go before `include(GNUInstallDirs)`. set(CMAKE_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")