[CMake] Resolving static lib dependency at executable link time

Pierre Mallard mallard.pierre at gmail.com
Mon Feb 25 06:19:31 EST 2013


Hello everyone,

This is certainly a known issue but I coulnd't find anything related to
this needs on internet :

I got :
an executable EX, a static library B and a static library C with cross
dependencies :
libB depends on libC and libC depends on libB.
EX depends on libB

If I write :
TARGET_LINK_LIBRARIES(libB libC)
TARGET_LINK_LIBRARIES(libC libB)
TARGET_LINK_LIBRARIES(EX libB)

Code compiles and everything is fine.

But then I would like to compile with two different flavor of libC : libC1
and libC2 both available with one make.

I want to do :
TARGET_LINK_LIBRARIES(libB ???)
 TARGET_LINK_LIBRARIES(libC1 libB)
TARGET_LINK_LIBRARIES(libC2 libB)
TARGET_LINK_LIBRARIES(EX1 libB libC1)
TARGET_LINK_LIBRARIES(EX2 libB libC2)

Problem is that if I don't set the right TARGET_LINK_LIBRARIES for libB I
got unresolved dependencies at EX1/2 link time for symbol resolved in
libCXXX.

Having a library libB1 and libB2 is not an option.

Any idea anyone ?
Thanks a lot
Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130225/28044e6b/attachment.htm>


More information about the CMake mailing list