Warning, /frameworks/extra-cmake-modules/modules/ECMCoverageOption.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@kde.org>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 #[=======================================================================[.rst:
0006 ECMCoverageOption
0007 --------------------
0008 
0009 Allow users to easily enable GCov code coverage support.
0010 
0011 Code coverage allows you to check how much of your codebase is covered by
0012 your tests. This module makes it easy to build with support for
0013 `GCov <https://gcc.gnu.org/onlinedocs/gcc/Gcov.html>`_.
0014 
0015 When this module is included, a ``BUILD_COVERAGE`` option is added (default
0016 ``OFF``). Turning this option on enables GCC's coverage instrumentation, and
0017 links against ``libgcov``.
0018 
0019 .. note::
0020   This will probably break the build if you are not using GCC.
0021 
0022 Since 1.3.0.
0023 #]=======================================================================]
0024 
0025 option(BUILD_COVERAGE "Build the project with gcov support" OFF)
0026 
0027 if(BUILD_COVERAGE)
0028     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
0029     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
0030 endif()