[cmake-developers] Wrong linker flags generation when the library filename is not prefixed with "lib"

Samuel Martin s.martin49 at gmail.com
Thu Nov 28 08:58:07 EST 2013


Hi all,

I've just trigger a weird bug:

I work on a standard Linux OS.
I use a 3rd-party library which is installed in /usr/lib/foo.so.

When I try to link against it, "find_libray" correctly found it:
---
CMakeCache.txt:
FOO_LIBRARIES:INTERNAL=general;/usr/lib/foo.so
---

But the generated linker flags are wrong:
---
link.txt:
/usr/bin/c++   -g    CMakeFiles/bar.dir/main.cpp.o  -o bin/bar -rdynamic
-lfoo
---

In case the the linker will look for a /usr/lib/libfoo.so file, so the
build will fail.

I trigger this bug in both cmake 2.8.11.1 and 2.8.12.1

Note that, if foo.so is installed in /usr/local/lib/foo.so, then the bug is
not trigger since the generated linker command is:
---
link.txt
/usr/bin/c++   -g    CMakeFiles/bar.dir/main.cpp.o  -o bin/bar -rdynamic
/usr/local/lib/foo.so
---

Regards,


-- 
Samuel Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20131128/3f90bb88/attachment.html>


More information about the cmake-developers mailing list