[cmake-developers] [Patch] Adding Windows 10 support

Gilles Khouzam Gilles.Khouzam at microsoft.com
Wed Sep 30 17:05:45 EDT 2015


Hi Brad,

I've changed the code of the 3rd patch to remove the WINDOWS_TARGET_PLATFORM_VERSION and CMAKE_WINDOWS_TARGET_PLATFORM_VERSION and simply use the SystemVersion to determine the version of the Windows 10 SDK to use.

Now, by default on Windows 10 host devices with Visual Studio 2015, the latest SDK will be used. I've also changed the sorting of the SDKs and comparison checks to use cmSystemTools::VersionCompare.


-----Original Message-----
From: Gilles Khouzam 
Sent: Monday, September 28, 2015 14:35
To: Brad King <brad.king at kitware.com>
Cc: cmake-developers at cmake.org
Subject: RE: [cmake-developers] [Patch] Adding Windows 10 support

The more I think about it, the more this makes sense and should work out well.

Let me take your current changes and adapt them for this and test them out.

-----Original Message-----
From: Gilles Khouzam
Sent: Friday, September 25, 2015 14:55
To: 'Brad King' <brad.king at kitware.com>
Cc: cmake-developers at cmake.org
Subject: RE: [cmake-developers] [Patch] Adding Windows 10 support

You're right, by targeting another version (8.1 or 6.3), the tag would not be written. 

Leveraging CMAKE_SYSTEM_VERSION is an interesting idea. Let me mull it over a little bit more and see how I would apply to newer SDKs as they come out, as I would like to minimize the required changes to CMake to support things when they come out (I'm gathering some information on that).


-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com]
Sent: Friday, September 25, 2015 11:53
To: Gilles Khouzam <Gilles.Khouzam at microsoft.com>
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] [Patch] Adding Windows 10 support

On 09/25/2015 01:00 PM, Gilles Khouzam wrote:
> This was done deliberately to only force a value for 
> CMAKE_WINDOWS_TARGET_PLATFORM_VERSION

With the approach in my patch that variable is never set by the generator.  It chooses a WindowsTargetPlatformVersion value and reports it in CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.
The CMAKE_WINDOWS_TARGET_PLATFORM_VERSION variable is only for the user-defined selection.

> when the CMAKE_SYSTEM_VERSION is specified as 10.0.
> Otherwise any Windows 10 machine will use the Windows 10 SDK and not 
> the Windows 8.1 SDK

Why is it wrong to target the host's version by default?
This is commonly done on other platforms.  If one is building only for the current host this makes sense.  If one is building for deployment then extra care is needed anyway.

> and I'm not sure that there is a way then target the Windows 8.1 SDK.

If one wants to build on a Windows 10 host but target an older version of Windows, one can simply do -DCMAKE_SYSTEM_VERSION=6.3 for example.  This is thanks to your patch that allows it to be set separately from CMAKE_SYSTEM_NAME.

Actually, why do we need a separate setting like CMAKE_WINDOWS_TARGET_PLATFORM_VERSION to select this at all?
Why not just take the highest available SDK that does not exceed CMAKE_SYSTEM_VERSION?  CMAKE_SYSTEM_VERSION is meant exactly to specify the target OS version.  You posted something about this here:

 https://cmake.org/Bug/view.php?id=15670#c39247

but I do not quite understand it.

Thanks,
-Brad

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-VS-Add-support-for-selecting-the-Windows-10-SDK.PATCH
Type: application/octet-stream
Size: 11459 bytes
Desc: 0003-VS-Add-support-for-selecting-the-Windows-10-SDK.PATCH
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150930/d6682cfc/attachment.obj>


More information about the cmake-developers mailing list