CMAKE_SYSTEM_NAME

The name of the operating system for which CMake is to build. See the CMAKE_SYSTEM_VERSION variable for the OS version.

Note that CMAKE_SYSTEM_NAME is not set to anything by default when running in script mode, since it's not building anything.

System Name for Host Builds

CMAKE_SYSTEM_NAME is by default set to the same value as the CMAKE_HOST_SYSTEM_NAME variable so that the build targets the host system.

System Name for Cross Compiling

CMAKE_SYSTEM_NAME may be set explicitly when first configuring a new build tree in order to enable cross compiling. In this case the CMAKE_SYSTEM_VERSION variable must also be set explicitly.

System Names Known to CMake

The following is a list of possible values, each associated with corresponding operating systems or environments.

Apple Platforms

Darwin

Apple stationary operating systems (macOS, OS X, etc.)

iOS

在 3.14 版被加入.

Apple mobile phone operating system

tvOS

在 3.14 版被加入.

Apple TV operating system

visionOS

在 3.28 版被加入.

Apple mixed reality operating system

watchOS

在 3.14 版被加入.

Apple watch operating system

UNIX Platforms

ADSP

Analog Devices Audio Digital Signal Processing

AIX

IBM Unix 作業系統

Android

在 3.1 版被加入.

Android 作業系統

ARTOS

在 3.4 版被加入.

Operating system for microcontrollers

BeOS

Operating system for personal computers (discontinued)

BlueGeneL

Blue Gene/L static environment

BlueGeneP-dynamic

Blue Gene/P dynamic environment

BlueGeneP-static

Blue Gene/P static environment

BlueGeneQ-dynamic

在 3.3 版被加入.

Blue Gene/Q dynamic environment

BlueGeneQ-static

在 3.3 版被加入.

Blue Gene/Q static environment

BSDOS

BSD operating system (discontinued)

Catamount

Operating system for Cray XT series

CrayLinuxEnvironment

在 3.5 版被加入.

Cray Linux Environment

DragonFly

BSD-derived operating system

eCos

Real-time embedded operating system

Emscripten

在 4.2 版被加入.

Compiler toolchain to WebAssembly.

Euros

在 3.4 版被加入.

Real-time operating system for embedded devices

FreeBSD

FreeBSD 作業系統

Fuchsia

在 3.8 版被加入.

Operating system by Google based on the Zircon kernel

Generic-ADSP

Generic ADSP (Audio DSP) environment

Generic-ELF

在 3.23 版被加入.

Generic ELF (Executable and Linkable Format) environment

Generic

Some platforms, e.g. bare metal embedded devices

GHS-MULTI

在 3.3 版被加入.

Green Hills Software MULTI environment

GNU

GNU/Hurd-based operating system

Haiku

Unix operating system inspired by BeOS

HP-UX

Hewlett Packard Unix (discontinued)

Linux

All Linux-based distributions

MirBSD

MirOS BSD operating system

MP-RAS

MP-RAS UNIX operating system

NetBSD

NetBSD 作業系統

OHOS

在 3.30 版被加入.

OpenHarmony family of operating systems (e.g., HarmonyOS)

Toolchain file can set this value when targeting OpenHarmony operating systems.

OpenBSD

OpenBSD 作業系統

OpenVMS

OpenVMS operating system by HP

OS2

在 3.18 版被加入.

OS/2 operating system

OSF1

Compaq Tru64 UNIX (formerly DEC OSF/1, Digital Unix) (discontinued)

QNX

Unix-like operating system by BlackBerry

RISCos

RISC OS operating system

SCO_SV

SCO OpenServer 5

SerenityOS

在 3.25 版被加入.

Unix-like operating system

SINIX

SINIX 作業系統

SunOS

Oracle Solaris and all illumos operating systems

syllable

Syllable operating system

Tru64

Compaq Tru64 UNIX (formerly DEC OSF/1) operating system

ULTRIX

Unix operating system (discontinued)

UNIX_SV

SCO UnixWare (pre release 7)

UnixWare

SCO UnixWare 7

WASI

在 3.31 版被加入.

WebAssembly System Interface

Xenix

SCO Xenix Unix operating system (discontinued)

Windows Platforms

CYGWIN

Cygwin environment for Windows

Cygwin's cmake package (/usr/bin/cmake) uses system name CYGWIN. A non-cygwin CMake on Windows (e.g. $PROGRAMFILES/CMake/bin/cmake) uses system name Windows even when it runs under a Cygwin environment.

DOS

MS-DOS or compatible

Midipix

在 3.10 版被加入.

POSIX-compatible layer for Windows

MSYS

MSYS environment (MSYSTEM=MSYS)

MSYS2's msys/cmake package (/usr/bin/cmake) works only under MSYSTEM=MSYS environments, with system name MSYS. Under other environments like MSYSTEM=MINGW64, use another package such as mingw64/mingw-w64-x86_64-cmake (/mingw64/bin/cmake), which targets MSYSTEM=MINGW64 with system name Windows.

Windows

Windows stationary operating systems

WindowsCE

Windows Embedded Compact

WindowsKernelModeDriver

在 4.1 版被加入.

Windows Kernel-Mode Driver

When building drivers for Kernel-Mode Driver Framework on Windows, toolchain file can set this value. See also the CMAKE_WINDOWS_KMDF_VERSION variable.

WindowsPhone

在 3.1 版被加入.

Windows mobile phone operating system

WindowsStore

在 3.1 版被加入.

Universal Windows Platform applications

Removed Platforms

The following platforms were once supported by CMake and got removed either due to platform's EOL, or other incompatibilities:

kFreeBSD

在 4.1 版的變更: Removed from CMake.

FreeBSD kernel with a GNU userland