[CMake] Sharing sources between two targets

Rolf Eike Beer eike at sf-mail.de
Mon Apr 22 15:13:06 EDT 2013


Nick Gnedin wrote:
> That doubles the size of the executable, because if I do something like
> that:
> 
> ADD_LIBRARY(temp STATIC ${sources})
> TARGET_LINK_LIBRARIES(temp outside_deps)
> 
> ADD_EXECUTABLE(code main.cpp)
> TARGET_LINK_LIBRARIES(code temp)
> 
> then TARGET_LINK_LIBRARIES(...) also add outside_deps as link libraries
> for code, so they end up included twice.

You can't link anything into a static library, so it will end up being linked 
in only once anyway.

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130422/f1845455/attachment.pgp>


More information about the CMake mailing list