File: PTLCoverage.cmake

package info (click to toggle)
ptl 2.3.3-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,296 kB
  • sloc: cpp: 8,195; python: 246; sh: 7; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 1,053 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|(Apple)?Clang")
    set(ptl_coverage_args "--coverage")
    check_cxx_compiler_flag("-fprofile-abs-path ${PTL_COVERAGE_FLAGS}"
                            PTL_HAS_PROFILE_ABS_PATH)
    if(PTL_HAS_PROFILE_ABS_PATH)
        string(APPEND ptl_coverage_args " -fprofile-abs-path")
    endif()
else()
    set(ptl_coverage_args)
    message(
        WARNING
            "PTL_USE_COVERAGE is ON, but is not supported for compiler '${CMAKE_CXX_COMPILER_ID}"
        )
endif()

# We're setting the DEBUG CXX flags and C flags because we only use coverage in Debug
# builds but want them to propagate down Once CMake 3.13 is the minimum, we can use
# add_{compile,link}_options + genexs instead
string(APPEND CMAKE_C_FLAGS_DEBUG " ${ptl_coverage_args}")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${ptl_coverage_args}")
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " ${ptl_coverage_args}")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG " ${ptl_coverage_args}")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_DEBUG " ${ptl_coverage_args}")