diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2015-01-28 22:08:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-03 15:40:58 (GMT) |
commit | 5c828cc89b4f78eceaf0402719cf5693a6627935 (patch) | |
tree | 896c3a25c7dfe2a959f509574a7584f58b38a279 /Modules | |
parent | 30cb628ecb31484015136bf6065c9c40f59a9297 (diff) | |
download | CMake-5c828cc89b4f78eceaf0402719cf5693a6627935.zip CMake-5c828cc89b4f78eceaf0402719cf5693a6627935.tar.gz CMake-5c828cc89b4f78eceaf0402719cf5693a6627935.tar.bz2 |
CTestCoverageCollectGCOV: Allow custom flags to gcov
Add a GCOV_OPTIONS option to allow specification of custom flags. In
ctest_coverage gcov support, if you set CTEST_COVERAGE_EXTRA_FLAGS, they
get put on the command line before the -o. In this case we remove the
-b and replace it with GCOV_OPTIONS. All other arguments remain the
same.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CTestCoverageCollectGCOV.cmake | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index f8058cd..dd10e83 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -19,6 +19,7 @@ # ctest_coverage_collect_gcov(TARBALL <tarfile> # [SOURCE <source_dir>][BUILD <build_dir>] # [GCOV_COMMAND <gcov_command>] +# [GCOV_OPTIONS <options>...] # ) # # Run gcov and package a tar file for CDash. The options are: @@ -39,6 +40,11 @@ # ``GCOV_COMMAND <gcov_command>`` # Specify the full path to the ``gcov`` command on the machine. # Default is the value of :variable:`CTEST_COVERAGE_COMMAND`. +# +# ``GCOV_OPTIONS <options>...`` +# Specify options to be passed to gcov. The ``gcov`` command +# is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``. +# If not specified, the default option is just ``-b``. #============================================================================= # Copyright 2014-2015 Kitware, Inc. @@ -56,7 +62,7 @@ include(CMakeParseArguments) function(ctest_coverage_collect_gcov) set(options "") set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND) - set(multiValueArgs "") + set(multiValueArgs GCOV_OPTIONS) cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}" "${multiValueArgs}" "" ${ARGN} ) if(NOT DEFINED GCOV_TARBALL) @@ -113,11 +119,18 @@ function(ctest_coverage_collect_gcov) get_filename_component(gcov_dir ${gcda_file} DIRECTORY) # run gcov, this will produce the .gcov file in the current # working directory + if(NOT DEFINED GCOV_GCOV_OPTIONS) + set(GCOV_GCOV_OPTIONS -b) + endif() execute_process(COMMAND - ${gcov_command} -b -o ${gcov_dir} ${gcda_file} + ${gcov_command} ${GCOV_GCOV_OPTIONS} -o ${gcov_dir} ${gcda_file} OUTPUT_VARIABLE out + RESULT_VARIABLE res WORKING_DIRECTORY ${coverage_dir}) endforeach() + if(NOT "${res}" EQUAL 0) + message(STATUS "Error running gcov: ${res} ${out}") + endif() # create json file with project information file(WRITE ${coverage_dir}/data.json "{ |