# compile CMake (32 bit) with Visual Studio 2019

**URL:** https://discourse.cmake.org/t/compile-cmake-32-bit-with-visual-studio-2019/3307
**Category:** Usage
**Created:** [May 12, 2021, 6:46pm UTC](https://discourse.cmake.org/t/compile-cmake-32-bit-with-visual-studio-2019/3307 "2021-05-12T18:46:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nitawa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/nitawa/32/1438_2.png) [@nitawa](https://discourse.cmake.org/u/nitawa)
#### Post date: [May 12, 2021, 6:46pm UTC](https://discourse.cmake.org/t/compile-cmake-32-bit-with-visual-studio-2019/3307/1 "2021-05-12T18:46:16Z")

</div>

dear experts,  
I installed both Visual Studio 2017 and Visual Studio 2019 on my Microsoft Windows 10 workstation.  
I tried to compile cmake as a 32 bit application and did not manage to get it compile with Visual Studio 2019 while it works with Visual Studio 2017.  
Here are the steps after I downloaded cmake sources.

```
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE:STRING=Release -A Win32 -Thost=x64 -DCMAKE_GENERATOR="Visual Studio 16 2019" ..
msbuild /p:Configuration=Release ALL_BUILD.vcxproj /p:PlatformTarget=Win32
msbuild /p:Configuration=Release INSTALL.vcxproj /p:PlatformTarget=Win32

```

I get errors at compilation stage:  
`C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\oaidl.h(487,17): error C2059: erreur de syntaxeÿ: '/' (compilation du fichier source D:\S\XXXXXX\SOURCES\cmake\Source\kwsys\Terminal.c) [D:\S\XXXXXXXX\BUILD\cmake\Source\kwsys\cmsys.vcxproj]`

On the other hand, if I use Visual Studio 15 2017 as CMAKE\_GENERATOR it works, and I checked that the generated binary is 32 bits as returned by 7z utility:  
7z l cmake.exe|findstr CPU  
CPU = x86

Am I missing some import step in my build procedure, given it works with Visual 2017 ?  
Thanks for your valuable help.

---

<div class="post-metadata">

### Author: ![rleigh](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/9de053/32.png) [@rleigh](https://discourse.cmake.org/u/rleigh)
#### Post date: [May 12, 2021, 7:27pm UTC](https://discourse.cmake.org/t/compile-cmake-32-bit-with-visual-studio-2019/3307/2 "2021-05-12T19:27:46Z")

</div>

> [@nitawa](#):
>
> C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\oaidl.h(487,17)

What is the actual syntax error on this line of the file?

Have you tried the latest kit? I have 10.0.18362.0.

---

<div class="post-metadata">

### Author: ![nitawa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/nitawa/32/1438_2.png) [@nitawa](https://discourse.cmake.org/u/nitawa)
#### Post date: [May 12, 2021, 9:31pm UTC](https://discourse.cmake.org/t/compile-cmake-32-bit-with-visual-studio-2019/3307/3 "2021-05-12T21:31:33Z")

</div>

thanks for the hint. Moving to 10.0.19041.0 resolved the issue!  
Just in case one hits the same issue, in order to target a given SDK version, I added to the cmake command line:  
`-DCMAKE_SYSTEM_VERSION=10.0.19041.0`
