[CMake] CTest: another sub-directory issue / coverage test
Johannes Stallkamp
johannes.stallkamp at rub.de
Tue Nov 10 03:43:52 EST 2009
Hello,
I am still experimenting and learning how to setup CTest/CDash support
for our projects.
We have the following directory structure for our projects:
Foo/
cmake
CMakeLists.txt
CTestConfig.cmake
include
Foo.h
src
Foo.cpp
FooTest.cpp
Running CMake generates DartConfiguration.tcl in my build directory
with source directory set to Foo/cmake. This actually prevents running
the code coverage test successfully.
It only covers the header file Foo.h and not the source code (which is
compiled/linked with the required compiler switches). If I manually
modify the source directory in DartConfiguration.tcl
to Foo/ it works just fine and all code including Foo.cpp (FooTest is
linked against libFoo which is compiled from Foo.cpp) is checked for
coverage.
Is this intended behaviour?
My first attempt to solve this issue was to change (in
DartConfiguration.tcl.in)
SourceDirectory: @PROJECT_SOURCE_DIR@
to
SourceDirectory: @PROJECT_SOURCE_DIR@/..
which results in
SourceDirectory: /Foo/cmake/..
when running cmake. This is/should be equivalent to
SourceDirectory: /Foo
but somehow it is not. The code coverage test did not cover all files,
just the headers.
So, my current workaround is to modify DartConfiguration.tcl.in to
SourceDirectory: @PROJECT_ROOT@
which I manually set to "/Foo" with
GET_FILENAME_COMPONENT( PROJECT_ROOT ${PROJECT_SOURCE_DIR}/.. ABSOLUTE )
While writing the email, I just found
http://public.kitware.com/Bug/view.php?id=9678 (CTest fails to
summarize code coverage using gcov for files compiled outside
PROJECT_SOURCE_DIR subtree)
and I think this is actually related. But shouldnt't the first
approach using "/.." work neverthless? Excluding system files
definitely makes sense but if I explicitly set the source directory,
CTest should accept that.
Any comments?
Johannes
More information about the CMake
mailing list