diff options
-rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 4 | ||||
-rw-r--r-- | modules/ECMCoverageOption.cmake | 36 |
2 files changed, 39 insertions, 1 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 728bb413..fbb464d1 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -420,4 +420,6 @@ if (MINGW AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols") endif() -include ( ECMEnableSanitizers ) +include(ECMEnableSanitizers) +include(ECMCoverageOption) + diff --git a/modules/ECMCoverageOption.cmake b/modules/ECMCoverageOption.cmake new file mode 100644 index 00000000..8d435de8 --- /dev/null +++ b/modules/ECMCoverageOption.cmake @@ -0,0 +1,36 @@ +#.rst: +# ECMCoverageOption +# -------------------- +# +# Creates a BUILD_COVERAGE option, so the project can be built with code coverage +# support. +# +# :: +# +# BUILD_COVERAGE +# +# If it's on, the project will be compiled with code coverage support, using +# gcov. Otherwise, it will be built normally. +# +# :: +# +# +#============================================================================= +# Copyright 2014 Aleix Pol Gonzalez <aleixpol@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file COPYING-CMAKE-SCRIPTS for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of extra-cmake-modules, substitute the full +# License text for the above reference.) + +option(BUILD_COVERAGE "Build the project with gcov support" OFF) + +if(BUILD_COVERAGE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") +endif() |