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

m.hergarden m.hergarden at euphoria-it.nl
Wed Feb 8 06:43:16 EST 2012


On 02/08/2012 12:00 PM, Rolf Eike Beer wrote:
>> 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
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
Thank you for your quick reply. I will try the regex changes you 
mentioned. It turns out I had forgotten to explicitly read the 
CTestCustom.cmake script in the ctest -S script ( 
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") ), so that caused 
the file to not be parsed at all.

Micha


More information about the CMake mailing list