[CMake] Resolving static lib dependency at executable link time

Andreas Stahl andreas.stahl at tu-dresden.de
Mon Feb 25 08:22:14 EST 2013


Hello Pierre,
self reply as a correction, sorry:
what I meant was that only linking the executables
TARGET_LINK_LIBRARIES(EX1 libB libC1)
TARGET_LINK_LIBRARIES(EX2 libB libC2)
should suffice.

Andreas


Am 25.02.2013 um 14:14 schrieb Andreas Stahl:

> Hello Pierre,
> 
> my knowledge concerning the linking process is rather limited, but wouldn't that mean you don't need to inter-link the libraries at all, when the symbols are resolved at link-time with the executable?
> add_executable(ex1 libB libC1 libC2) should suffice then.
> 
> Best regards,
> Andreas
> 
> 
> Am 25.02.2013 um 13:47 schrieb Pierre Mallard:
> 
>> Well it is indeed possible and it works... Note that static libraries 's object files are built with unresolved symbols. Final resolution is performed when building executable
>> Therefore libB can compile without libC and conversely ...
>> Anyone else ?
>> 
>> 
>> 
>> On Mon, Feb 25, 2013 at 12:23 PM, Ansis Māliņš <ansis.malins at gmail.com> wrote:
>>> libB depends on libC and libC depends on libB.
>> How is that even possible? You compile B and it fails because there's no C yet. You compile C and it fails because there's no B yet.
>> 
>> --
>> 
>> 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
> 
> --
> 
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4681 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130225/47640d7e/attachment-0001.bin>


More information about the CMake mailing list