On 05/20/2010 01:04 PM, "Christoph Rüdiger" wrote:
> Hi!
> 
> I'm new to cmake and couldn't find a solution for my problem:
> 
> 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().

Regards,

Michael
_______________________________________________
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