problem with compiling and linking the same file into different libraries

Markus Mohrhard markus.mohrhard at
Sun Apr 8 09:30:01 PDT 2012


I'm currently working on a unit test and bug fix for the cursor
movement in calc. There are so many corner cases that we decided that
we would benefit from writing tests for this. Since it is inside the
view part and can be easily separated from the rest of calc I decided
to write a real unit test and use mocking to break dependencies. This
works quite well and the test is simple and executed quite fast.

The problem is now that I have to compile and link the cursormove.cxx
source file into libsclo and into the unit test. Currently our build
system does not support this and I have no idea if it is possible to
add support for this.

I attached a patch that shows the problem. In I use qa/unit/cursormove.cxx and
source/ui/view/cursormove.cxx. They are compiled against the header
files in qa/unit/mock. source/ui/view/cursormove.cxx is also used in but compiled against the calc header files.

There are currently 2 related problems. First the check for duplicated
linked objects complains that cursormove.o is linked into two libs and
then David pointed out that cursormove.cxx is only compiled once with
my current approach. So one of the two makefiles uses an object file
that uses the wrong header files.

I have currently no idea how I can solve these problems. Do you have
an idea or a solution?


The patch is based on a week old master so it might not apply cleanly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ScCursorMovement-unit-test-for-cursor-movement.patch
Type: application/octet-stream
Size: 44407 bytes
Desc: not available
URL: <>

More information about the LibreOffice mailing list