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

_______________________________________________
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

Reply via email to