How to use CMake with cygwin/mingw toolchain?

Yaakov Selkowitz yselkowitz@cygwin.com
Fri Oct 20 21:11:00 GMT 2017


On 2017-10-20 07:50, Peter Quiring wrote:
> What is the current process to use the mingw toolchain that is
> included with cygwin?

Treat it like any other cross-compiling scenario.

> There use to be a -mno-cygwin option used with gcc.

That was an ugly hack which never really worked correctly and which we
happily rid ourselves years ago.

> The mingw versions have x86_64-w64-mingw32- or i686-w64-mingw32- added
> to their exe names. Currently I just use these directly but I want to
> use cmake.
> 
> Cygwin also includes cmake. How would I configure it to use the mingw
> toolset that is included with cygwin?

You need to provide a number of options, see:

https://github.com/cygwinports/cygport/blob/master/cygclass/cmake.cygclass#L137

> I also see some Qt5 *.cmake modules included in the Qt5 libraries for mingw.

Those, like all my packages, are built with cygport.

> Would it be possible to include a version of cmake built for mingw?

No, but you can create a CMake toolchain file with all the options so
that you don't have to specify them each time:

https://cmake.org/Wiki/CMake_Cross_Compiling

-- 
Yaakov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20171020/decd9ddf/attachment.sig>


More information about the Cygwin mailing list