[CMake] CMAKE_xxx_LIBRARY_PREFIX
Eric Noulard
eric.noulard at gmail.com
Fri Sep 28 16:35:14 EDT 2007
2007/9/28, Bill Hoffman <bill.hoffman at kitware.com>:
> The lib prefix is so that gcc can automatically link to the library with
> the usual -L -l stuff.
>From my "very first" today experience giving up the 'lib' prefix
is OK with mingw on a windows box (did not try a cross compiler though)
Moreover, from the MinGW documentation you have:
http://www.mingw.org/docs.shtml#compilingandbuilding
===
To create the dll and an executable that uses it, try the following:
gcc -c hello.c
gcc -c -DBUILD_DLL dllfct.c
gcc -shared -o tst.dll -Wl,--out-implib,libtstdll.a dllfct.o
gcc -o hello.exe hello.o -L./ -ltst
===
One more clear from GNU binutils specific win32 gnu ld behavior
one can read:
http://sourceware.org/binutils/docs-2.18/ld/WIN32.html#WIN32
direct linking to a dll
[...]
Linking directly to a dll uses no extra command-line switches
other than -L and -l, because ld already searches for a number of
names to match each library.
[...]
For instance, when ld is called with the argument -lxxx it will
attempt to find, in the first directory of its search path,
libxxx.dll.a
xxx.dll.a
libxxx.a
cygxxx.dll (*)
libxxx.dll
xxx.dll
I really think it's safe when both WIN32 and MINGW to set the lib prefix to "".
I think that using this I may build more consistent DLL name.
--
Erk
More information about the CMake
mailing list