# PLATFORM\_ID vs. WIN32 vs. CMAKE\_SYSTEM\_NAME

**URL:** https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226
**Category:** Code
**Created:** [May 17, 2020, 6:54am UTC](https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226 "2020-05-17T06:54:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ocroquette](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/dbc845/32.png) [@ocroquette](https://discourse.cmake.org/u/ocroquette)
#### Post date: [May 17, 2020, 6:54am UTC](https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226/1 "2020-05-17T06:54:54Z")

</div>

Hi,

I am bit confused about which of PLATFORM\_ID vs. WIN32 vs. CMAKE\_SYSTEM\_NAME to use.

My build system supports Windows and macOS, so it looks like:

- for normal branching in the CMake scripts, I have the choice between CMAKE\_SYSTEM\_NAME=“Windows/Darwin” and the variables WIN32/APPLE
- in generator expressions, I have the choice between PLATFORM\_ID and WIN32/APPLE

WIN32/APPLE has the advantage of being universal in this context, but they look like legacy variables and not very clean (APPLE could also mean iOS, WIN32 is also true for Windows 64bit).

What’s the modern way to do this?

Olivier

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 18, 2020, 12:09pm UTC](https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226/2 "2020-05-18T12:09:38Z")

</div>

The `WIN32`, `APPLE`, `UNIX`, etc. variables are “soft” deprecated due to this. We’ll never actually get them removed in the wider ecosystem, so they mean what they mean with all the conflations and ambiguities they come with. `CMAKE_SYSTEM_NAME` is what I’d use in CMake code, `PLATFORM_ID` is needed in generator expressions. A bit unfortunate about the naming difference if there isn’t some other difference, but I guess that needs documented if so?

---

<div class="post-metadata">

### Author: ![ocroquette](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/dbc845/32.png) [@ocroquette](https://discourse.cmake.org/u/ocroquette)
#### Post date: [May 19, 2020, 9:55pm UTC](https://discourse.cmake.org/t/platform-id-vs-win32-vs-cmake-system-name/1226/3 "2020-05-19T21:55:25Z")

</div>

OK, thanks
