[CMake] Finding MinGW compiler libraries?

Bob Paddock bob.paddock at gmail.com
Sun Jul 27 09:28:32 EDT 2008


> > 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).


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.

> then it seems it's not a MinGW problem. 

I never thought it was a MinGW problem.

> You just  
> need to make sure that you link to all libraries that you use.

I did link to the libraries that *I* used.  Problem is that
wxWidgets wxfile wants to link to MinGW uuid and ole32, which I did
not know until I got the linker errors.  Then it took
some digging to find out which libraries wxfile was trying
to use.  Then more digging to figure out the CMake way
of getting them to link, which I failed to find a working
solution to on my own hence this message thread.

> 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.

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...



-- 
                http://www.wearablesmartsensors.com/
 http://www.softwaresafety.net/ http://www.designer-iii.com/
                 http://www.unusualresearch.com/


More information about the CMake mailing list