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

Gilles Khouzam Gilles.Khouzam at microsoft.com
Thu Sep 10 14:37:33 EDT 2015


Brad,

>From my understanding GetVersionEx was causing a nightmare of app compatibility issues where developers would make the wrong comparison or assumption based on the version and applications would break on new releases. I don't know that deprecating the API and making it require a manifest was a better solution, but it does require more intentional work on the developer before just using the API. For the usage that CMake is using it is benign and doesn't look like it would cause compatibility issues.

Here's the updated patch for Windows 10 support.

1. Added support for Windows Universal applications as CMAKE_SYSTEM_NAME=WindowsStore and CMAKE_SYSTEM_VERSION=10.0
2. Added support for manifest files, when specifying a manifest as a source file, it will be added to the <AdditionalManifestFiles> tag of the <Manifest> section in the vcxproj file (VisualStudio 10 generator only). Multiple manifests could be added.
3. Added a manifest to the CMake executables to enable proper version API support on Windows 8 and above. The file is Source\cmake.version.manifest.
4. Added a detection mechanism to figure out which Windows 10 SDK is installed and can be used on the machine. This follows the detection logic that VS 2015 uses. The SDK selected will be the latest SDK that is less or equal to the build of the HOST. This change requires the manifest.
5. Added Windows 10 Universal tests in VSWinStorePhone
6. Added a 2 new target properties: VS_TARGET_PLATFORM_VERSION and VS_TARGET_PLATFORM_MIN_VERSION, these set the <WindowsTargetPlatformVersion> and <WindowsTargetPlatformMinVersion> tags in the vcxproj file. If VS_TARGET_PLATFORM_VERSION is not set for a target and is required, a default is set a CMAKE_VS_TARGET_PLATFORM_VERSION based on the lastest usable Windows 10 SDK.
 7. Added a new target property VS_TOOL_OVERRIDE to enable adding new file types to VS without requiring to teach CMake how to handle them. This property, set on a source file will override the default tool assigned in Visual Studio. This enables support for RESW files for example without teaching CMake how to handle them.
8. Added support for Windows 10 extensions with 3 new properties: VS_DESKTOP_EXTENSIONS_VERSION, VS_MOBILE_EXTENSIONS_VERSION and VS_IOT_EXTENSIONS_VERSION. These specify the version of the different extensions and whether they are used. When an extension is used, an SDK reference is added for that extension.
9. Added a new property: VS_IOT_STARTUP_TASK to specify if the target has a startup task for and IOT project.

I realize that there are a lot of changes in here, but the combination of them are all required for proper Windows 10 support. I can split it up in multiple patches if that makes it easier.

#2 and #3 could be a different patch that Windows 10 support depends on.


-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Thursday, September 10, 2015 06:39
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/09/2015 05:48 PM, Gilles Khouzam wrote:
> Even though GetVersionEx is deprecated, it is the right way to get the 
> system version, loading ntdll and getting RtlGetVersion is not a good 
> practice as those are private APIs that could change.

The change was contributed recently:

 Windows: Fix CMAKE_HOST_SYSTEM_VERSION on Windows >= 8.1 (#15674)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4736d53

for this issue:

 http://www.cmake.org/Bug/view.php?id=15674

I've re-opened the issue.  I would really like to know why MS deprecated GetVersionEx.  The Version Helper APIs are only good for checking >= level, not getting the actual version.  Why not add the helpers and leave GetVersionEx available too?  Why do we need to add a manifest just to get the OS version?  What is a library author supposed to do when s/he cannot control the application that will link the library?

FYI, the GetVersionEx documentation page:

 https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451%28v=vs.85%29.aspx

has a community-mentioned recommendation to use RtlGetVersion.

Thanks,
-Brad

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Windows10.patch
Type: application/octet-stream
Size: 49289 bytes
Desc: Windows10.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150910/73d16fab/attachment-0001.obj>


More information about the cmake-developers mailing list