~unity8-desktop-session-team/indicator-session/indicator-session-using-upstart

« back to all changes in this revision

Viewing changes to cmake/GCov.cmake

  • Committer: Charles Kerr
  • Date: 2012-07-05 15:45:10 UTC
  • Revision ID: charles.kerr@canonical.com-20120705154510-q6dhcpn2lrosssv7
copyediting

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
if (CMAKE_BUILD_TYPE MATCHES coverage)
2
 
  set(GCOV_FLAGS "${GCOV_FLAGS} --coverage")
3
 
  set(CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS}    ${GCOV_FLAGS}")
4
 
  set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}")
5
 
  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCOV_FLAGS}")
6
 
  set(GCOV_LIBS ${GCOV_LIBS} gcov)
7
 
 
8
 
  find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
9
 
  if (NOT GCOVR_EXECUTABLE)
10
 
    message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
11
 
  else ()
12
 
    message(STATUS "Gcovr found, can generate XML coverage info.")
13
 
    add_custom_target (coverage-xml
14
 
      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
15
 
      COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" -x -r "${CMAKE_SOURCE_DIR}" 
16
 
      --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
17
 
  endif()
18
 
 
19
 
  find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
20
 
  find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
21
 
  if (NOT LCOV_EXECUTABLE)
22
 
    message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
23
 
  else ()
24
 
    if(NOT GENHTML_EXECUTABLE)
25
 
      message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
26
 
    else()
27
 
      message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
28
 
      add_custom_target (coverage-html
29
 
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
30
 
        COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose
31
 
        COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture | ${CMAKE_SOURCE_DIR}/trim-lcov.py > dconf-lcov.info
32
 
        COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details dconf-lcov.info
33
 
        COMMAND ${CMAKE_COMMAND} -E echo ""
34
 
        COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html"
35
 
        COMMAND ${CMAKE_COMMAND} -E echo "")
36
 
        #COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture --output-file coverage.info --no-checksum
37
 
        #COMMAND "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
38
 
        #COMMAND ${CMAKE_COMMAND} -E echo "\\#define foo \\\"bar\\\"" 
39
 
        #)
40
 
    endif()
41
 
  endif()
42
 
endif()
43
 
 
44
 
 
45
 
        #$(MAKE) $(AM_MAKEFLAGS) check
46
 
        #lcov --directory $(top_builddir) --capture --test-name dconf | $(top_srcdir)/trim-lcov.py > dconf-lcov.info
47
 
        #LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info
48
 
        #@echo
49
 
        #@echo "     file://$(abs_top_builddir)/lcov-html/index.html"
50
 
        #@echo