فهرست منبع

HPCC-8483 - Add build options to simplify coverage analysis

For systems that support gcov, add options to make it easier to do
code-coverage analysis.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 سال پیش
والد
کامیت
a054de4c35
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      cmake_modules/commonSetup.cmake

+ 5 - 1
cmake_modules/commonSetup.cmake

@@ -69,7 +69,8 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   option(DOCS_EPUB "Create EPUB Docs" OFF)
   option(DOCS_MOBI "Create Mobi Docs" OFF)
   option(USE_RESOURCE "Use resource download in ECLWatch" OFF)
-  
+  option(GENERATE_COVERAGE_INFO "Generate coverage info for gcov" OFF)
+
   if ( USE_XALAN AND USE_LIBXSLT )
       set(USE_XALAN OFF)
   endif()
@@ -177,6 +178,9 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
           SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type")
         endif ()
       endif ()
+      if (GENERATE_COVERAGE_INFO)
+        SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+      endif()
     endif ()
     if (CMAKE_COMPILER_IS_CLANGXX)
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=logical-op-parentheses -Werror=bool-conversions -Werror=return-type -Werror=comment")