tests: make code coverage for unit tests optional
[vpp.git] / src / CMakeLists.txt
index 5327735..a1764f7 100644 (file)
@@ -125,6 +125,10 @@ if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE")
   endif()
 endif()
 
+if(VPP_USE_LTO)
+  check_c_compiler_flag("-Wno-stringop-overflow"
+                       compiler_flag_no_stringop_overflow)
+endif()
 ##############################################################################
 # sanitizers
 ##############################################################################
@@ -152,6 +156,14 @@ if(VPP_ENABLE_TRAJECTORY_TRACE)
   add_compile_definitions(VLIB_BUFFER_TRACE_TRAJECTORY=1)
 endif()
 
+##############################################################################
+# unittest with clang ode coverage
+##############################################################################
+
+if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.13" AND "${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
+  option(VPP_BUILD_TESTS_WITH_COVERAGE "Build unit tests with code coverage" OFF)
+endif()
+
 ##############################################################################
 # install config
 ##############################################################################