[CMake] /path/to/libpng.so automatic conversion to -lpng ?

Rolf Eike Beer eike at sf-mail.de
Wed Jul 12 13:08:08 EDT 2017


Am Mittwoch, 12. Juli 2017, 18:31:56 schrieb René J. V. Bertin:
> Andreas Naumann wrote:
> > cmake instrospects your compiler and asks for system directories. Only
> > these system directories will be removed and the corresponding libraries
> > will be linked by -l<...>. So, you should check your compiler and the
> > environment. I had several problems years ago with the environment
> > variable LIBRARY_PATH, which leads to such a behavior.
> 
> Hello Andreas,
> 
> Aha, I indeed have LIBRARY_PATH=/opt/local/lib set (by the build scripts I
> use). From what I understand, that variable allows you to specify a set of
> -L directories via an env. variable (other than LDFLAGS).
> 
> It seems that clang handles that variable in a somewhat different manner
> than GCC does. Even in a very simple call on the commandline (including the
> -v option) I see it adds -L/opt/local/lib AFTER the user-supplied
> libraries, where GCC puts it before the 1st -l option.

Welcome to the work of link_directories(). This is exactly the reason to avoid 
it: it always causes trouble.

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170712/b0654f61/attachment.sig>


More information about the CMake mailing list