[CMake] FIND_LIBRARY & mingw

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Tue Oct 16 14:55:20 EDT 2007


Alexander Camek schrieb:
> Hi Christian
> 
>> That's not true - on windows with mingw you link against .a
>> And cmake also search for .a (and .dll.a) but *also* for .lib which is 
>> imho a bug. When I've an import lib for msvc - foo.lib and one for 
>> mingw - foo.a I get foo.a for mingw, but as soon as I remove foo.a I 
>> get foo.lib which is wrong.
> 
> Not really, i can also link with a .lib under mingw.
> And if you can't link with .lib file under mingw, then it would be a 
> mingw bug at all, because both are endings. 
That's the point - you can't mix msvc and mingw libs. You can only mix 
them as long as you stay in plain old C mode!
 > It should contain the
> correct machine representation. It would iritate me if i could link 
> under windows against a elf (linux libs mostly .a ended) and it will 
> work correctly.
> 
> But that's not the topic here.
> 
> So if you look under your installation path, there under Modules and 
> Platform. There is a file called Windows-gcc.cmake this will be used if 
> you are using under Windows gcc.
> 
> There is the part:
> IF(MINGW)
>   SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
>   SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
> ENDIF(MINGW)
> 
> So it first looks for a dll, then for dll.a, then for .a and after that 
> .lib.
> 
> So it is not a bug, it is your thinking how it should behave.
> 
It's a bug - because I don't know if foo.lib is a static import lib for 
a plain C or C++ dll

Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20071016/ebacb8ba/signature.pgp


More information about the CMake mailing list