[CMake] To avoid target_link_libraries magic

Brad King brad.king at kitware.com
Mon Mar 21 10:05:08 EDT 2011


On 3/21/2011 9:42 AM, Valeriy Bykov wrote:
> 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

What version of CMake are you using?  Since 2.6 the above example
should link using the full path to the library.

-Brad


More information about the CMake mailing list