wrapper: use CMAKE_SYSTEM_NAME to detect Windows

This commit is contained in:
Danny Robson 2019-06-28 10:47:29 +10:00
parent 0701b07ad5
commit 3fc04e698e

View File

@ -76,16 +76,16 @@ defaults = {
env = defaults.copy()
env.update(os.environ)
# MinGW pretends to be its own platform. Try to work around their deception by
# testing if the platform string looks like something that's actually useful.
def is_really_windows() -> bool:
name = platform.system()
def host_platform(tuple: str) -> str:
return {
'x86_64-w64-mingw32': 'Windows'
}[tuple]
if name == 'Windows':
return True
if name.startswith('MINGW'):
return True
return False
# Don't use `platform.system()` as MinGW will pretend to be its own platform,
# and cross compiling will give you CBUILD rather than CHOST.
def is_really_windows() -> bool:
return "@CMAKE_SYSTEM_NAME@" == "Windows"
# MSYS2 wants to fuck us over by supplying a CMake that gives something