From ea6d56c3518dc3af0f326f52a266bc0986d8635c Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Thu, 25 Jul 2024 21:42:22 +0800
Subject: [PATCH] protobuf: add coverage compile option

Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d17f09d..0b169f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,9 @@ cmake_minimum_required(VERSION 3.10...3.26)
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,now -fstack-check -fPIE")
 set(CMAKE_EXE_LINKER_FLAGS "-pie")
+if (ENABLE_CONVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+endif()
 
 # Revert to old behavior for MSVC debug symbols.
 if(POLICY CMP0141)
-- 
2.25.1

