[CMake] Simple (?) lib linking question

Anders Sundman anders.sundman at optonova.se
Thu Aug 3 17:46:48 EDT 2006


> Anders Sundman wrote:
>> /usr/bin/libtool: can't locate file for: -llibb
>> /usr/bin/libtool: file: -llibb is not an object file (not allowed in a
>> library)
>>
>
> I see the problem:
>
> ADD_LIBRARY(liba SHARED liba.cpp)
> ...
> TARGET_LINK_LIBRARIES(liba libb)
>
> CMake handles the "lib" part for you. This should look more like:
>
> ADD_LIBRARY(a SHARED liba.cpp)
> ...
> TARGET_LINK_LIBRARIES(a b)
>
> CMake will generate "liba.dylib" and "libb.a" and such.
>
> --
> Jorge Rodriguez
> XVT Software Development
> Email: jrodriguez at xvt.com
> Phone: (919) 854-1800 x222
>

Thank you for your comment. I should have chosen better names in my
example to avoid confusion, but this is not the problem. At least I don't
think so.

ADD_LIBRARY(liba SHARED liba.cpp) creates the library libliba.dylib (the
other lib is named liblibb.dylib, so TARGET_LINK_LIBRARIES(liba libb)
should be right.

// Anders Sundman



More information about the CMake mailing list