[CMake] [CTest] request information on usage of CTEST_CUSTOM_COVERAGE_EXCLUDE and CTestCustom.cmake

Rolf Eike Beer eike at sf-mail.de
Wed Feb 8 06:00:48 EST 2012


> I would like to exclude third party header files from the coverage
> output. We're using ctest, cmake (version 2.8.5) and cdash, all on
> Linux. The archive layout is as follows:
>
> /
> /Code/
> /Code/Application/
> /Code/Application/src/
> /Code/Third-Party/
> /Code/Third-Party/boost/
> /Code/Third-Party/boost/boost-1-47-0/
> /Code/Third-Party/boost/boost-1-47-0/include/
> /Code/Third-Party/boost/boost-1-47-0/lib/
> /Code/Build/
>
> The /Code/Build directory contains a script that is called using ctest
> -S /Code/Build/buildscript. The /Code directory contains a
> CMakeLists.txt, a CTestConfig.cmake and a CTestCustom.cmake file.
>
> The CMakeLists.txt file in /Code/Application/src/ uses
> CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CTestCustom.cmake
> ${CMAKE_BINARY_DIR}/CTestCustom.cmake COPYONLY) to copy the
> CTestCustom.cmake file to the toplevel of the builddirectory. The file
> does indeed end up in the toplevel builddirectory.
>
> The CTestCustom.cmake file is as follows:
>
> SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
>   ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
>   "/Code/Third-Party/*"
>   )
>
> I compile all code with the following flags:
> SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs
> -ftest-coverage")
>
> Although coverage does get sent to the CDash dashboard, the results
> contain more than I would like to see. I would like to exclude the .hpp
> files from the /Code/Third-Party/boost/boost-1-47-0/include/ directory
> from the dashboard.
>
> My questions:
>
> -- Is the /Code/Third-Party/* expression recursive, or do I need to add
> the full path to the include directory of boost?

You don't need the * at all, it will just match anywhere in the path. And
since it's a regular expression I think your intention was "/.*" anyway.

> -- Does the '/' at the front of the path mean the CMAKE_SOURCE_DIR?

It just means "a directory", so it wont match "/FunnyCode/Third-Party".

> Any advice or pointers to information on how to achieve the exclusion
> would be greatly appreciated.

You need to put the file in CMAKE_BINARY_DIR, otherwise it will get ignored.

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CTestCustom.cmake
${CMAKE_BINARY_DIR}/CTestCustom.cmake @ONLY)

Eike


More information about the CMake mailing list