[CMake] static library linking

Steven Van Ingelgem steven at vaningelgem.be
Sun Jun 15 05:47:20 EDT 2008


A small example (and verified on a clean SUSE installation):

====================
PROJECT(test)

cmake_policy(SET CMP0003 NEW)

ADD_EXECUTABLE(
  test
  main.cpp
)
TARGET_LINK_LIBRARIES(
  test
  /usr/lib/libpthread.a
  /usr/lib/librt.a
  /usr/lib/libc.a
)
====================

==> this won't set the .a's in the commandline as it should do, but rather
link it via -Wl,-Bstatic...


And I really need those static links, because no single other library on the
system exports the required symbols, not even the shared ones.


Greetings

2008/6/15 Steven Van Ingelgem <steven at vaningelgem.be>:

> Hi,
>
>
> I have a question about CMP0003...
> When I give the full path to a static library, it's supposed to link
> against that one... But right now I'm linking against:
> "/usr/lib/libpthread.a" (message before the target_link_libraries call)
> This results however in "-Wl,-Bstatic -lpthread"... Which doesn't seem like
> the correct behaviour?
>
> What could be the reason for this?
>
>
>
> Thanks,
> Steven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080615/00e4d896/attachment.htm>


More information about the CMake mailing list