[CMake] Finding MinGW compiler libraries?

Bob Paddock bob.paddock at gmail.com
Sun Jul 27 10:02:01 EDT 2008

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

MinGW is installed in standard fashion.  Nothing unusual there.
No environment variables, like LIB etc., are set that might cause

> if(MINGW)
> target_link_libraries(foo uuid ole32 shell32)
> endif(MINGW)

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

To me that seems counter to the whole reason to use CMake
in the first place.  I could have just written Makefile to do that.

This is where I'm coming from.  I wrote a XML parser
to deal with Atmel configuration files on Linux.
I wanted it to be cross platform.  I knew that
the autotools would be a problem to make a Windows
version, so I thought I'd give CMake a try,
even bought your book.  Everything worked just great
on Linux, no problems at all.  Quickly had a working

However as chronicled in a couple of threads here
I've found using CMake with MinGW in conjunction
with wxWidgets to be a nightmare.  I've spent
days trying to get things to link, and still
don't have a working program.  I know many
of the issue have been self inflicted as I learn
CMake.  I expected everything to 'just work'
the way it did under Linux.  Apparently
my expectation was to optimistic,
after all this is Windows.

Perhaps if someone could point me to a working example
of MinGW (Not MSYS)/wxWidgets/CMake would help?

Miguel has been especially patient with me, both on and off the
list here, in getting my CMake/MinGW/wxWidgets issues sorted out,
and I want to publicly thank him for all of his help.

More information about the CMake mailing list