[CMake] To avoid target_link_libraries magic

Valeriy Bykov valery.bickov at gmail.com
Mon Mar 21 10:17:18 EDT 2011


Ough, behaviour of target_link_libraries depends on -B flags I pass to
compiler. I pass it for proper compiler test made by CMake at initial stage.
Without it gcc can't link simple test program because can't find
standart libraries (-lc).

On Mon, Mar 21, 2011 at 05:12:56PM +0300, Valeriy Bykov wrote:
> I'm using CMake version 2.8.4. Furthermore I use custom ToolChain but I
> don't think it is important.
>
> On Mon, Mar 21, 2011 at 10:05:08AM -0400, Brad King wrote:
> > 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