[CMake] To avoid target_link_libraries magic
Valeriy Bykov
valery.bickov at gmail.com
Mon Mar 21 09:42:31 EDT 2011
Hello.
I'm trying to link with static library which I've found using FIND_LIBRARY:
MESSAGE (${LPTHREAD}) prints /home/vbykov/svn/builddeps/glibc/lib/libpthread.a
Further I do the next:
ADD_EXECUTABLE (test_atomic_lock test_atomic_lock.c)
TARGET_LINK_LIBRARIES (test_atomic_lock ${LPTHREAD})
But full path to the library turns into "-Bstatic -lpthread
-Bdynamic" magically, and in the line of collect2 options appears:
-static -o test_atomic_lock -Bstatic -lpthread -Bdynamic --start-group -lgcc -lgcc_eh -lc --end-group
(I've omitted a lot of other libraries and object files). Therefore
-Bdynamic applies to -lgcc and other libraries, which I want to link statically.
So can I adjust this target_link_libraries behaviour and pass plainly
what I want?
--
Best regards,
Valeriy Bykov
More information about the CMake
mailing list