# Selecting Windows SDK 8.1

**URL:** https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822
**Category:** Usage
**Tags:** os:windows
**Created:** [April 4, 2023, 7:47am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822 "2023-04-04T07:47:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![pedahl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pedahl/32/3307_2.png) [@pedahl](https://discourse.cmake.org/u/pedahl)
#### Post date: [April 4, 2023, 7:47am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/1 "2023-04-04T07:47:52Z")

</div>

Hello,  
I want to build my project against the Windows SDK 8.1.  
I have no idea how to configure cmake to use it?  
Can someone help me?

---

<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: [April 24, 2023, 4:16am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/2 "2023-04-24T04:16:20Z")

</div>

I think you need to set the target platform as the appropriate version. I don’t remember how to do that off-hand though and the docs don’t show anything with a quick search.

@craig.scott ?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [April 24, 2023, 7:00am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/3 "2023-04-24T07:00:52Z")

</div>

I don’t know if this is a viable solution, but in our CI script we have:  
`call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 10.0.22621.0`  
To build against specific version of the SDK. If I remember correctly to pick 8.1 SDK, you have to pass `8` as the argument instead.

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [April 24, 2023, 8:02am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/4 "2023-04-24T08:02:07Z")

</div>

For Visual Studio generator, set CMAKE\_SYSTEM\_VERSION to e.g. 7

Bitte that you have to install this SDK separately, it is not part of VS installer anymore.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [April 25, 2023, 6:46am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/5 "2023-04-25T06:46:49Z")

</div>

> [@ben.boeckel](#):
>
> I think you need to set the target platform as the appropriate version. I don’t remember how to do that off-hand though and the docs don’t show anything with a quick search.

The docs for [CMAKE\_VS\_WINDOWS\_TARGET\_PLATFORM\_VERSION](https://cmake.org/cmake/help/latest/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.html) might give a clue. As @hsattler mentioned, it seems like you need to set `CMAKE_SYSTEM_VERSION`, but I’m not sure exactly what values map to what SDK versions.

---

<div class="post-metadata">

### Author: ![pedahl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pedahl/32/3307_2.png) [@pedahl](https://discourse.cmake.org/u/pedahl)
#### Post date: [April 25, 2023, 7:49pm UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/6 "2023-04-25T19:49:08Z")

</div>

I have solved it. I set the environment “CMAKE\_SYSTEM\_VERSION”=“8.1”  
in the CMakeSettings.json.  
Now CMake use the Windows SDK 8.1A

---

<div class="post-metadata">

### Author: ![stavbodik](https://discourse.cmake.org/user_avatar/discourse.cmake.org/stavbodik/32/3440_2.png) [@stavbodik](https://discourse.cmake.org/u/stavbodik)
#### Post date: [May 15, 2023, 9:48am UTC](https://discourse.cmake.org/t/selecting-windows-sdk-8-1/7822/7 "2023-05-15T09:48:03Z")

</div>

“The `CMAKE_SYSTEM_VERSION` should be set on the command line on the _first_ configuration of a new build tree ( **cmake-gui has options to add it as a cache entry before configuring** ). It is part of defining the target platform, and should remain constant once a build tree is first configured. Alternatively, it can be set in a toolchain file during cross-compiling, but I don’t thi  
nk that is relevant to your use case.”

 ![entry](https://discourse.cmake.org/uploads/default/original/2X/3/39c2e553b08243e069b66afe59f06cf3d00fb466.png)

Thanks to [Brad King](https://gitlab.kitware.com/brad.king)

posted here :

[https://gitlab.kitware.com/cmake/cmake/-/issues/16713](https://gitlab.kitware.com/cmake/cmake/-/issues/16713)
