[CMake] cmake 2.6 and find_library with MinGW generator

Bill Hoffman bill.hoffman at kitware.com
Wed May 21 09:52:13 EDT 2008


Christian Ehrlicher wrote:
> Hi,
> 
> during your new warning when mixing libs in target_link_libraries 
> (CMP0003) I changed target_link_libraries(foo ws2_32) to
> 
> find_library(WS2_32_LIBRARY ws2_32)
> target_link_libraries(foo ${WS2_32_LIBRARY})
> 
> but now cmake finds ws2_32.dll in system32 instead the correct one 
> (ws2_32.dll.a / ws2_32.a) in mingw dir.
> 


AHHHH!!!

This is the most misunderstood warning of all times....  :)


You do not have to use full paths for all libraries now.
You do not have to use full paths for all libraries now.

For system libraries like this one it is much safer to just list them. 
If you set the policy to NEW, it will just work with no warnings. The 
warning says that it maybe a problem, but to try it as NEW, and if it is 
not a problem, then you are good.

For this case I would recommend changing ws2_32 to not being found.  It 
is a standard library that the compiler should be able to find the 
appropriate version of.

-Bill





More information about the CMake mailing list