View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015674CMakeCMakepublic2015-07-30 12:362016-02-01 09:10
ReporterChristian Maaser 
Assigned ToGilles Khouzam 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPCOSWindowsOS Version
Product VersionCMake 3.3 
Target VersionCMake 3.4Fixed in VersionCMake 3.4 
Summary0015674: Windows: Correctly determine Windows version for CMAKE_HOST_SYSTEM_VERSION
Descriptioncmake is currently using the deprecated Windows API function GetVersionEx, which reports wrong information for versions later than WindowsXP. Instead, cmake should make use of RtlGetVersion, which works as expected on all versions of Windows (since Windows 2000).
Steps To ReproduceCompare ${CMAKE_HOST_SYSTEM_VERSION} with the output of the "ver" console command.
Additional Informationhttps://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx [^]
https://msdn.microsoft.com/en-us/library/windows/hardware/ff561910(v=vs.85).aspx [^]
TagsNo tags attached.
Attached Filespatch file icon cmake-3.3.0-cmake_host_system_version.patch [^] (2,504 bytes) 2015-07-30 12:43 [Show Content]
patch file icon Issue15674.patch [^] (15,614 bytes) 2015-09-10 16:54 [Show Content]

 Relationships
related to 0015670closedGilles Khouzam Add support for setting "Windows target platform version" in VS2015 

  Notes
(0039201)
Christian Maaser (reporter)
2015-07-30 12:43

I wrote a patch against 3.3.0, which correctly sets the Windows version based on RtlGetVersion. In case the function fails it falls back to using the old behavior. This needs some testing and also might break existing projects, which rely on the previously reported wrong version number.

Also note that I decided to include to build number in the version string (e.g. "10.0.10240" on latest Windows 10).
(0039204)
Brad King (manager)
2015-07-30 14:12

For reference, there are some explanations about why GetVersionEx returns the older value on Windows >= 8.1:

 http://stackoverflow.com/questions/27246562/how-to-get-the-os-version-in-win8-1-as-getversion-getversionex-are-deprecated [^]
 http://stackoverflow.com/questions/19518670/winapi-deprecation-after-windows-8-1 [^]
(0039205)
Brad King (manager)
2015-07-30 14:22
edited on: 2015-07-31 10:13

Applied, thanks:

 Windows: Fix CMAKE_HOST_SYSTEM_VERSION on Windows >= 8.1
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4736d53 [^]

I tweaked it a bit to build on MinGW where RTL_OSVERSIONINFOEXW is not (readily) available.

(0039390)
Brad King (manager)
2015-09-10 08:39

According to:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14201/focus=14296 [^]

The RtlGetVersion API is not meant for public use.
(0039402)
Brad King (manager)
2015-09-10 16:05

For now I've reverted the fix from 0015674:0039205:

 Revert "Windows: Fix CMAKE_HOST_SYSTEM_VERSION on Windows >= 8.1"
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c7744c8 [^]
(0039442)
Brad King (manager)
2015-09-18 14:21

Relevant mailing list thread:

 [PATCH] [CMake 0015674]: Windows: Correctly determine Windows version
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14327 [^]
(0039443)
Brad King (manager)
2015-09-18 14:22
edited on: 2015-09-21 09:03

I added Windows *.manifest support to all generators with MSVC tools:

 Add support for *.manifest source files with MSVC tools
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e134e53b [^]

Then I added the manifest patch sent in the linked mailing list threads:

 Windows: Fix CMAKE_HOST_SYSTEM_VERSION on Windows >= 8
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17009189 [^]

(0040411)
Robert Maynard (manager)
2016-02-01 09:10

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-07-30 12:36 Christian Maaser New Issue
2015-07-30 12:43 Christian Maaser File Added: cmake-3.3.0-cmake_host_system_version.patch
2015-07-30 12:43 Christian Maaser Note Added: 0039201
2015-07-30 14:12 Brad King Note Added: 0039204
2015-07-30 14:22 Brad King Note Added: 0039205
2015-07-30 14:22 Brad King Assigned To => Brad King
2015-07-30 14:22 Brad King Status new => resolved
2015-07-30 14:22 Brad King Resolution open => fixed
2015-07-30 14:22 Brad King Fixed in Version => CMake 3.4
2015-07-30 14:22 Brad King Target Version => CMake 3.4
2015-07-31 10:12 Brad King Relationship added related to 0015670
2015-07-31 10:13 Brad King Note Edited: 0039205
2015-09-10 08:39 Brad King Note Added: 0039390
2015-09-10 08:39 Brad King Assigned To Brad King => Gilles Khouzam
2015-09-10 08:39 Brad King Status resolved => assigned
2015-09-10 08:39 Brad King Resolution fixed => open
2015-09-10 08:39 Brad King Fixed in Version CMake 3.4 =>
2015-09-10 08:39 Brad King Target Version CMake 3.4 =>
2015-09-10 08:40 Brad King Target Version => CMake 3.4
2015-09-10 16:05 Brad King Note Added: 0039402
2015-09-10 16:54 Gilles Khouzam File Added: Issue15674.patch
2015-09-18 14:21 Brad King Note Added: 0039442
2015-09-18 14:22 Brad King Note Added: 0039443
2015-09-21 09:03 Brad King Note Edited: 0039443
2015-09-21 09:03 Brad King Status assigned => resolved
2015-09-21 09:03 Brad King Resolution open => fixed
2015-09-21 09:03 Brad King Fixed in Version => CMake 3.4
2016-02-01 09:10 Robert Maynard Note Added: 0040411
2016-02-01 09:10 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team