[CMake] Finding MinGW compiler libraries?

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sun Jul 27 11:22:04 EDT 2008


On Sun, Jul 27, 2008 at 8:28 AM, Bob Paddock wrote:
>> > Something like this:
>> >
>> > if(MINGW)
>> > target_link_libraries(foo uuid ole32 shell32)
>> > endif(MINGW)
>>
>> Bob,
>>
>> If the above worked,
>
> if( MINGW )
> TARGET_LINK_LIBRARIES( part_description_aggregator ${wxWidgets_LIBRARIES}
> TinyXPath uuid ole32 shell32 )
> else( MINGW )
> TARGET_LINK_LIBRARIES( part_description_aggregator ${wxWidgets_LIBRARIES}
> TinyXPath )
> endif( MINGW )
>
> Got the program to link.  Then it crashes at runtime with two different
> errors.  One saying I'm using a debug library with a non-debug program.
> I'm not sure how I write my 'program' to be a debug one?
> I think I know what I configured wrong there,  I'll look into it.
>
>
> Fatal Error: Mismatch between the program and library build versions detected.
>  The library used 2.8 (debug,ANSI,compiler with C++ ABI 1002,wx
> containers,compatible with 2.6),
>  and your program used 2.8 (no debug,ANSI,compiler with C++ ABI 1002,wx
> containers,compatible with 2.6).

Make sure you build the "no debug" version of wxWidgets and then make
sure that you select the following:

wxWidgets_CONFIGURATION == mswu (msw unicode non-debug)

and

wxWidgets_USE_REL_AND_DBG == TRUE

You might need to remove the CMakeCache for this.

> The more puzzling crash comes last that says "Microsoft Visual C++ Runtime
> Library".  Where/why is that coming from when using MinGW?
> Visual C++ is not installed on this machine.

Probably just picking up a ms visual c++ dll in the system.

> These are what makefile.gcc have in the wxWidgets samples:
>  -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
>
> Also I changed FindwxWidgets to this:
>        NAMES msw/build.cfg mswd/build.cfg mswu/build.cfg mswud/build.cfg
>
> Having even more linking errors with the Unicode stuff, but I'll open that
> can of worms later.  Didn't have any errors of any kind on Linux...

I'll add whatever is needed to the FindwxWidgets after we fix everything.

--Miguel


More information about the CMake mailing list