[CMake] Finding MinGW compiler libraries?

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sun Jul 27 07:53:16 EDT 2008


On Sat, Jul 26, 2008 at 9:58 PM, Bill Hoffman wrote:
> Bob Paddock wrote:
>>
>> On Saturday 26 July 2008 03:28:59 pm Miguel A. Figueroa-Villanueva wrote:
>>
>>>> My project needs to link against C:\MinGW\lib\libuuid.a, amoung
>>>> others, but it is not being found.
>>>>
>>>> I tried this:
>>>>
>>>> find_library( MinGW_Libraries uuid )
>>>
>>> find_library(MinGW_Libraries uuid "C:/MinGW/lib")
>>>
>>> Does this work?
>>
>> Yes it did, thank you.
>>
>> That lead to the discovery that I also need libole32.a and/or libshell32.a
>> When doing the same thing, the wrong ones are found:
>>
>> MinGW_libole32 "C:/WINDOWS/system32/ole32.dll"
>> MinGW_libshell32 "C:/WINDOWS/system32/shell32.dll"
>> MinGW_libuuid "C:/MinGW/lib/libuuid.a"
>>
>
> For system libraries like this it is often better to just link them in with
> -l.  The compiler should be able to find them if it is installed correctly.
>  There is a good chance CMake will get it wrong.   So, the correct CMake
> solution for system/compiler libraries is to just use the name of the
> library.
>
> Something like this:
>
> if(MINGW)
> target_link_libraries(foo uuid ole32 shell32)
> endif(MINGW)

Bob,

If the above worked, then it seems it's not a MinGW problem. You just
need to make sure that you link to all libraries that you use. If all
programs that use these wxWidgets libraries will need uuid, ole32, and
shell32 then I think that we need to add them to the
wxWidgets_LIBRARIES list.

But, I'm not sure if this is the case...

--Miguel


More information about the CMake mailing list