Am 20.05.2010 um 13:33 schrieb Michael Hertling:
On 05/20/2010 01:04 PM, "Christoph Rüdiger" wrote:
[...]
I've a directory src containing the complete source code of the
program and
another directory called test containing the source code for the
unit tests.
In the top level directory is a CMakeLists.txt that points to the
subdirectories containing each an own CMakeLists.txt for building
the program or the unit tests.
Now I want to use the already build object files from the src
directory one time for linking the program and one time for linking
to the unit tests.
My current way is building a static library in the src directory
and link the unit tests against this library. But the sources would
be compiled twice: One time for the static library and one time for
the program itself.
Link the program against the static library, too, while removing
the latter's source files from the program's ADD_EXECUTABLE().
Then I need either one big library which I can link against each unit
test, resulting in a unit test of the size of the whole program plus
the size of the unit test, or I create smaller static libraries but
need to know each library in both CMakeLists.txt explicitly.
For later on there is a planning to build plugins which needs to be a
library I must explicit know in the unit test project, too. If
anything changes in the src tree, I have to modify the CMakeLists.txt
of the test tree, too.
I'm wondering if there is no solution for making files one time known
to the cmake process (the cpp files in my case) and use derived files
(the objects) in other process parts. I'm looking aroung for a
variable containing all objects, pass this to the linker and let the
linker figure out, which objects are needed in the current unit test.
The linking time increases, but at nightly test runs, this doesn't
matter.
Is it possible to have all projects together in the top level
directory CMakeLists.txt and include a separate file with the cpp-
Variables? (Separate the long list of source files from the project
admin commands)
Regards,
Christoph Ruediger
_______________________________________________
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