Skip to content

How to build for Windows

Billy O'Neal edited this page May 20, 2019 · 9 revisions

How to setup, build, and run tests on Windows

Setup Git

If you use PowerShell, we recommend installing Posh-Git (here is how).

If you use cmd.exe, open the Developer Command Prompt for VS2017 (here is how)

Get the source

git clone https://github.com/Microsoft/cpprestsdk.git

Build from source

We recommend using CMake and Vcpkg to build from source on Windows.

First, install the dependencies for the platform you are interested in:

vcpkg install --triplet x64-windows zlib openssl boost-system boost-date-time boost-regex boost-interprocess websocketpp brotli

Then, configure CMake against the Release\CMakeLists.txt file in the normal way while following the vcpkg instructions (Note: If you use the cmake-gui.exe tool, make sure to select the "Cross-compiling" option and choose the Vcpkg toolchain):

cpprestsdk> mkdir build.x64v141
cpprestsdk> cd build.x64v141
cpprestsdk/build.x64v141> cmake ../Release -A x64 -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake

You can either run cmake --build . --config Release or open the generated solution file in Visual Studio. The built binaries will be in Binaries\Release or Binaries\Debug depending on the configuration you build with.