Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

lcov.cmake 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # - This module creates a new 'lcov' target which generates
  2. # a coverage analysis html output.
  3. # LCOV is a graphical front-end for GCC's coverage testing tool gcov. Please see
  4. # http://ltp.sourceforge.net/coverage/lcov.php
  5. #
  6. # Usage: you must add an option to your CMakeLists.txt to build your application
  7. # with coverage support. Then you need to include this file to the lcov target.
  8. #
  9. # Example:
  10. # IF(BUILD_WITH_COVERAGE)
  11. # SET(CMAKE_C_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
  12. # SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
  13. # SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
  14. # include(${CMAKE_SOURCE_DIR}/cmake/lcov.cmake)
  15. # ENDIF(BUILD_WITH_COVERAGE)
  16. #=============================================================================
  17. # Copyright 2010 ascolab GmbH
  18. #
  19. # Distributed under the OSI-approved BSD License (the "License");
  20. # see accompanying file Copyright.txt for details.
  21. #
  22. # This software is distributed WITHOUT ANY WARRANTY; without even the
  23. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  24. # See the License for more information.
  25. #=============================================================================
  26. # (To distributed this file outside of CMake, substitute the full
  27. # License text for the above reference.)
  28. IF(BUILD_WITH_COVERAGE)
  29. # enable coverage analysis using GCC and GCOV
  30. IF (CMAKE_COMPILER_IS_GNUCC)
  31. SET(CMAKE_C_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
  32. SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
  33. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
  34. ENDIF()
  35. ENDIF(BUILD_WITH_COVERAGE)
  36. function(DO_COVERAGE)
  37. ## lcov target
  38. ADD_CUSTOM_TARGET(lcov)
  39. ADD_CUSTOM_COMMAND(TARGET lcov
  40. COMMAND mkdir -p coverage
  41. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  42. )
  43. ADD_CUSTOM_COMMAND(TARGET lcov
  44. COMMAND lcov --directory . --zerocounters
  45. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  46. )
  47. ADD_CUSTOM_COMMAND(TARGET lcov
  48. COMMAND make test
  49. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  50. )
  51. ADD_CUSTOM_COMMAND(TARGET lcov
  52. COMMAND lcov --directory . --capture --output-file ./coverage/stap.info
  53. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  54. )
  55. ADD_CUSTOM_COMMAND(TARGET lcov
  56. COMMAND genhtml -o ./coverage ./coverage/stap.info
  57. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  58. )
  59. ADD_CUSTOM_COMMAND(TARGET lcov
  60. COMMAND echo "Open ${CMAKE_BINARY_DIR}/coverage/index.html to view the coverage analysis results."
  61. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
  62. )
  63. ADD_DEPENDENCIES(lcov ${ARGV})
  64. endfunction(DO_COVERAGE)