[CMake] Simple (?) lib linking question

Anders Sundman anders.sundman at optonova.se
Thu Aug 3 17:20:49 EDT 2006


Hi all!

I'm new to cmake and I'm currently trying to get the hang of how it works.
Unfortunately, I'm stuck with a simple (?) problem that I can't seem to
work out. Any help will be much appreciated.

I have created a minimal (OS X) example to demonstrate the problem
(attached).

In short, the problem is this: I have a 3:rd party lib (libb in my
example), that should be used by one of my libs (liba in my example).
Finally, my lib should be used by my app. When I try to create my (shared)
library, the following error message appears:

Scanning dependencies of target liba
[ 50%] Building CXX object liba/CMakeFiles/liba.dir/liba.o
Linking CXX shared library libliba.dylib
/usr/bin/libtool: can't locate file for: -llibb
/usr/bin/libtool: file: -llibb is not an object file (not allowed in a
library)
make[2]: *** [liba/libliba.dylib] Error 1
make[1]: *** [liba/CMakeFiles/liba.dir/all] Error 2
make: *** [all] Error 2

If I build liba as a static library, the following message appears:

Scanning dependencies of target liba
[ 50%] Building CXX object liba/CMakeFiles/liba.dir/liba.o
Linking CXX static library libliba.a
[ 50%] Built target liba
Scanning dependencies of target appex
[100%] Building CXX object app/CMakeFiles/appex.dir/app.o
Linking CXX executable appex
/usr/bin/ld: can't locate file for: -llibb
collect2: ld returned 1 exit status
make[2]: *** [app/appex] Error 1
make[1]: *** [app/CMakeFiles/appex.dir/all] Error 2
make: *** [all] Error 2

What seems to be the problem? Any ideas?

Best regards,
Anders Sundman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmaketest2.zip
Type: application/zip
Size: 7943 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20060803/f1e2a717/cmaketest2.zip


More information about the CMake mailing list