From a75492b97c9b0c44ca02ad26ec1d3c6a56c95d16 Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@gmail.com>
Date: Wed, 22 Nov 2017 13:33:40 +0000
Subject: [PATCH] Use version 8.1 of the Windows SDK on Windows builders

The generated packages should all still run on Windows 7. Recent versions
of Visual Studio have started separating the SDK as an optional download
so it is easy to end up with just v10 installed. This change ensures
that all builds target 8.1.
---
 buildconfig/Jenkins/buildscript.bat | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/buildconfig/Jenkins/buildscript.bat b/buildconfig/Jenkins/buildscript.bat
index 912a7210aa6..aa65e1f79c4 100755
--- a/buildconfig/Jenkins/buildscript.bat
+++ b/buildconfig/Jenkins/buildscript.bat
@@ -12,7 +12,6 @@ setlocal enableextensions enabledelayedexpansion
 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 call cmake.exe --version
 echo %sha1%
-set VS_VERSION=14
 
 :: Find the grep tool for later
 for /f "delims=" %%I in ('where git') do @set GIT_EXE_DIR=%%~dpI
@@ -24,7 +23,11 @@ set GREP_EXE=%GIT_ROOT_DIR%\usr\bin\grep.exe
 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 :: Source the VS setup script
 set VS_VERSION=14
-call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
+:: 8.1 is backwards compatible with Windows 7. It allows us to target Windows 7
+:: when building on newer versions of Windows. This value must be supplied
+:: externally and cannot be supplied in the cmake configuration
+set SDK_VERSION=8.1
+call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 %SDK_VERSION%
 set CM_GENERATOR=Visual Studio 14 2015 Win64
 set PARAVIEW_DIR=%PARAVIEW_NEXT_DIR%
 
@@ -127,7 +130,7 @@ if not "%JOB_NAME%"=="%JOB_NAME:debug=%" (
 ) else (
   set VATES_OPT_VAL=ON
 )
-call cmake.exe -G "%CM_GENERATOR%" -DCONSOLE=OFF -DENABLE_CPACK=ON -DMAKE_VATES=%VATES_OPT_VAL% -DParaView_DIR=%PARAVIEW_DIR% -DMANTID_DATA_STORE=!MANTID_DATA_STORE! -DUSE_PRECOMPILED_HEADERS=ON -DENABLE_FILE_LOGGING=OFF %PACKAGE_OPTS% ..
+call cmake.exe -G "%CM_GENERATOR%" -DCMAKE_SYSTEM_VERSION=%SDK_VERSION% -DCONSOLE=OFF -DENABLE_CPACK=ON -DMAKE_VATES=%VATES_OPT_VAL% -DParaView_DIR=%PARAVIEW_DIR% -DMANTID_DATA_STORE=!MANTID_DATA_STORE! -DUSE_PRECOMPILED_HEADERS=ON -DENABLE_FILE_LOGGING=OFF %PACKAGE_OPTS% ..
 if ERRORLEVEL 1 exit /B %ERRORLEVEL%
 
 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-- 
GitLab