[CMake] target_link_libraries replacing fully-qualified library with -l<x>

Chris Green greenc at fnal.gov
Thu Jan 29 11:34:49 EST 2015


Hi,

On 1/29/15 9:36 AM, Brad King wrote:
> If you link tothis library using a full path manually, what is recorded
> in the NEEDED field of the resulting binary?  Without SONAME many linkers
> record the full path.  Does INPUT avoid that?
With the caveat that a -L is necessary for the linker to find the 
sonam-ed library based on the linker script (and with uncertainties over 
whether the same-named library in (e.g.) /usr/lib might jump in, thereby 
recreating the original problem), the correct NEEDED entry does seem to 
be made in the linked program:

$ objdump -p ../../bin/tbb_init_t-x | grep NEEDED
   NEEDED               libtbb.so.2
   NEEDED               libstdc++.so.6
   NEEDED               libm.so.6
   NEEDED               libgcc_s.so.1
   NEEDED               libc.so.6
   NEEDED               librt.so.1

I am extremely uneasy about the possibility of finding the wrong 
library, though.

Thanks,
Chris.

-- 
Chris Green <greenc at fnal.gov>, FNAL CS/SCD/ADSS/SSI/SSD;
'phone (630) 840-2167; Skype: chris.h.green;
IM: greenc at jabber.fnal.gov, chissgreen (AIM, Yahoo),
chissg at hotmail.com (MSNM), chris.h.green (Google Talk).



More information about the CMake mailing list