msys2: Unknown platform using MSYS2-MINGW32 in Windows 10


I am building a large cross-platform suite of commandline programs, no
issues with older MINGW on Win7 (32bit) system - Cmake recognises
platform id MINGW.

Now trying MINGW32 on Windows 10 (64bit OS, but I a targetting 32bit
WIN32), Cmake (v 3.21.1) reports this error:

System is unknown to cmake, create:

Of course, I need a working CMake ID for the platform, so that
appropriate flags and symbols are passed to the compiler.

I have attached my CopyOfCmakeCache.txt as instructed in error message.

I welcome any solution, even if a workaround to begin with.

Richard Dobson
Composers Desktop Project

CopyOfCMakeCache.txt (15.8 KB)

Cc: @brad.king

MSYS2 comes with two variants of cmake: one that targets the msys2 runtime, and one that targets Windows with the GNU ABI (mingw). Which cmake package are you using?

Thank you for a very quick reply. Sorry but I am relatively new to
MinGW generally, and vey new indeed to MSYS2 etc on Windows 10.

The requirement is to target Windows ( this is an LGPL github
distribution, the Cmakefiles support Mac and Linux too).

I installed msys2 using downloaded msys2-x86_64-20210725.exe, which gave
me four options in the Windows taskbar under “MSYS2 64bit” - including
MSYS2-minGW 32-bit and MSYS2 MinGW 64bit, the former ostensibly the one
I need to use.

Nothing much seemed available immediately, I had to use ‘pacman’ for all
of gcc, git and Cmake - I simply asked for 'cmake", not knowing what
other name options might be available. That is the cmake which proved
to offer no Generators for MinGW or MSVC. So I assume that is the answer
to your question, it must be the msys2 version.

At the moment, I have uninstalled the pacman cmake, and installed the
standard external Windows CMake from cmake.og, which has all the
expected Generators including Mingw32, and suffice it to say I have now
successfully built all programs for 32bit WIN32 using our existing
CMakefiles. But I would like to be able to use the “internal” MinGW-32
cmake, etc as it seems much tidier, self-contained - less to document
for users, ideally.

Thanks you,

Richard Dobson
Composers Desktop Project

One can use pacman -Ss cmake to search for packages related to cmake. There are three packages of CMake itself:

  • mingw32/mingw-w64-i686-cmake
  • mingw64/mingw-w64-x86_64-cmake
  • msys/cmake

Each of those is named based on the runtime environment and ABI for which it was built. You probably want mingw32/mingw-w64-i686-cmake.

Be sure to have /mingw32/bin near the front of your PATH to get the toolchain that targets 32-bit MinGW.

Thank you. That does indeed present a dizzyingly long list. Yes, I
already have mingw32/bin at the head of PATH.