[CMake] linking: absolute path vs -l<libname>

Nico Schlömer nico.schloemer at gmail.com
Wed Sep 2 16:28:35 EDT 2015


Curiously,
```
message(${ZLIB_LIBRARIES})
message(${netCDF_LIBRARIES})
```
yields
```
/usr/lib/x86_64-linux-gnu/libz.so
netcdf
```
Hm, I would have expected it the other way around. :)

--Nico

On Wed, Sep 2, 2015 at 10:17 PM Alexander Neundorf <a.neundorf-work at gmx.net>
wrote:

> On Wednesday, September 02, 2015 08:22:08 Nico Schlömer wrote:
> > > it uses -l if the full path is not know or if the full path is one of
> the
> > > system
> > library dirs
> >
> > Hm, that sound a little weird. Using `-l` appears to delegate the library
> > finding to the linker although CMake has already done that job. If one
> was
> > overly cautious, one could ask questions like: What if there are two
> > libraries by the same name in different system library dirs? What if
> > there's only one library in a system dir at configure time, but two at
> link
> > time?
> >
> > Moreover, in the example I gave above it seems that both libraries are in
> > the system path, yet still they are represented differently on the link
> > line.
>
> what values do ${ZLIB_LIBRARIES} and ${netCDF_LIBRARIES} have in your case
> ?
>
> Alex
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150902/9a74a278/attachment.html>


More information about the CMake mailing list