Skip to content

MINGW: Define variable only when targeting Windows platforms

Brad King requested to merge brad.king/cmake:platform-vars into master

The MINGW variable indicates that the compiler targets MinGW, a GNU ABI on Windows. Since commit aff31479, we load the Platform/Windows-GNU module for compilers targetin MinGW, so set the variable there instead. This is equivalent to Platform/Windows-MSVC setting the MSVC variable. Also remove if(MINGW) checks from the module, which have not been necessary since the enclosed logic was moved to that module. The undocumented CMAKE_COMPILER_IS_MINGW internal variable is now unused, so remove it too.

While at it, also remove redundant definitions of CYGWIN and UNIX variables on Cygwin. These are set by modules loaded for CMAKE_SYSTEM_NAME. We do not need to set them again if the compiler defines __CYGWIN__.

Fixes: #22647 (closed)

Edited by Brad King

Merge request reports