[CMake] Linking to a library: libfoo.so vs libfoo.so.1.2
Mathieu Malaterre
mathieu.malaterre at gmail.com
Mon May 19 08:47:20 EDT 2008
Hi Andreas,
On Mon, May 19, 2008 at 2:08 PM, Andreas Schneider <mail at cynapses.org> wrote:
> Mathieu Malaterre wrote:
>>
>> Hi there,
>>
>> I am inspecting a system using cmake, this system has the following:
>>
>> $ ls -al /lib/libuuid.so.1*
>> lrwxrwxrwx 1 root root 14 2008-01-10 17:51 /lib/libuuid.so.1 ->
>> libuuid.so.1.2
>> -rw-r--r-- 1 root root 10720 2007-12-06 16:55 /lib/libuuid.so.1.2
>>
>>
>> the question is: can I link to this library ? If yes, how do I do
>> that in cmake ?
>>
>> I was hoping it should be possible, since it's a c lib and the
>> symbol can be found:
>>
>> $ nm -D /lib/libuuid.so.1.2 | grep uuid_generate
>> 0000000000001700 T uuid_generate
>
> Normally you have a symlink /lib/libuuid.so which points to that file, so it
> is linked against this file.
I don't. Most Linux distrib require that you install a *-dev package
to get the libfoo.so linking to libfoo.so.1.2. A couple of linux
dashbaord machine running ITK dashboard do not have this symlink
either.
> As cmake is working with absolute path you can use the file directly too.
> But then you have do search for it manually.
Could you please describe *exactly* what you did before posting, so
that I can reproduce, I cannot achieve what you declare (cmake 2.4)
Linking C executable testuuid
/usr/bin/cmake -P CMakeFiles/testuuid.dir/cmake_clean_target.cmake
/usr/bin/gcc -Wall -W -fPIC "CMakeFiles/testuuid.dir/testuuid.o"
-o testuuid -rdynamic -L/lib -luuid -Wl,-rpath,/lib
/usr/bin/ld: cannot find -luuid
AFAIK, full path is *not* supported (at least not in cmake 2.4)
--
Mathieu
More information about the CMake
mailing list