[CMake] linking with a .a file
Pierre Chifflier
chifflier at cpe.fr
Sat Sep 30 14:40:37 EDT 2006
On Sat, Sep 30, 2006 at 11:13:57AM -0700, Alan W. Irwin wrote:
> On 2006-09-29 16:45+0200 Pierre Chifflier wrote:
>
> >Hi,
> >
> >I am currently trying to convert my project (wzdftpd) to cmake. The last
> >remaining problem is the following:
> >
> [...]
> >
> >If I use
> > TARGET_LINK_LIBRARIES (wzd_perl DynaLoader.a)
> >Then cmake will convert it to:
> > -lDynaLoader
> >which is wrong.
>
> Actually -l (when combined with -L) is a standard way to specify libraries
> (whether they are static or shared) to the linker. To make sure cmake
> generates the appropriate combination of -L and -l options, just specify the
> full path to DynaLoader.a, i.e.,
> /usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a.
>
If I add this path to TARGET_LINK_LIBRARIES, cmake generates -l/-L
options, but that does not work:
/usr/bin/gcc -fPIC -O3 -DNDEBUG -Wl,-E -L/usr/local/lib
/usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a
-L/usr/lib/perl/5.8/CORE -lperl -ldl -lm -lpthread -lc -lcrypt -shared
-Wl,-soname,libwzd_perl.so -o libwzd_perl.so
"CMakeFiles/wzd_perl.dir/libwzd_perl.o"
-L/home/pollux/WORK/PROGS/wzd/WZDFTPD/wzdftpd-cmake/build/libwzd-core
-L/usr/lib/perl/5.8/auto/DynaLoader -lwzd_core -lDynaLoader -lperl
^^^^ ^^^
-lpthread -lssl
-Wl,-rpath,/home/pollux/WORK/PROGS/wzd/WZDFTPD/wzdftpd-cmake/build/libwzd-core:/usr/lib/perl/5.8/auto/DynaLoader
/usr/bin/ld: cannot find -lDynaLoader
collect2: ld returned 1 exit status
Thanks,
Pierre
More information about the CMake
mailing list