[Cmake-commits] CMake branch, next, updated. v3.3.0-1572-gfdc227c

Brad King brad.king at kitware.com
Thu Jul 30 14:20:39 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  fdc227c297b54f0f7e8c158cdc6bb3ccdc8f01d4 (commit)
       via  28dc5b7e6b208e5a3e7be2b9e16ac9c1a3bc6635 (commit)
      from  107011a18580b70dffa1b643b93ecd6715303da9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdc227c297b54f0f7e8c158cdc6bb3ccdc8f01d4
commit fdc227c297b54f0f7e8c158cdc6bb3ccdc8f01d4
Merge: 107011a 28dc5b7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 30 14:20:38 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jul 30 14:20:38 2015 -0400

    Merge topic 'fix-windows-version-detection' into next
    
    28dc5b7e Windows: Fix CMAKE_HOST_SYSTEM_VERSION on newer versions (#15674)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28dc5b7e6b208e5a3e7be2b9e16ac9c1a3bc6635
commit 28dc5b7e6b208e5a3e7be2b9e16ac9c1a3bc6635
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jul 30 13:44:31 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jul 30 14:20:27 2015 -0400

    Windows: Fix CMAKE_HOST_SYSTEM_VERSION on newer versions (#15674)
    
    The GetVersionEx API is deprecated, so try RtlGetVersion first.
    
    Co-Author: Christian Maaser

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cd05c54..e171b0a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -14,6 +14,20 @@
 #if defined(_MSC_VER) && _MSC_VER >= 1800
 # define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
 #endif
+typedef struct {
+  ULONG  dwOSVersionInfoSize;
+  ULONG  dwMajorVersion;
+  ULONG  dwMinorVersion;
+  ULONG  dwBuildNumber;
+  ULONG  dwPlatformId;
+  WCHAR  szCSDVersion[128];
+  USHORT wServicePackMajor;
+  USHORT wServicePackMinor;
+  USHORT wSuiteMask;
+  UCHAR  wProductType;
+  UCHAR  wReserved;
+} CMRTL_OSVERSIONINFOEXW;
+
 #endif
 
 #include "cmGlobalGenerator.h"
@@ -437,23 +451,44 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
   if (!mf->GetDefinition("CMAKE_SYSTEM"))
     {
 #if defined(_WIN32) && !defined(__CYGWIN__)
-    /* Windows version number data.  */
-    OSVERSIONINFO osvi;
-    ZeroMemory(&osvi, sizeof(osvi));
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+    CMRTL_OSVERSIONINFOEXW osviex;
+    ZeroMemory(&osviex, sizeof(osviex));
+    osviex.dwOSVersionInfoSize = sizeof(osviex);
+
+    typedef LONG (FAR WINAPI *cmRtlGetVersion)(CMRTL_OSVERSIONINFOEXW*);
+    cmRtlGetVersion rtlGetVersion = reinterpret_cast<cmRtlGetVersion>(
+      GetProcAddress(GetModuleHandle(L"ntdll.dll"), "RtlGetVersion"));
+    if (rtlGetVersion && rtlGetVersion(&osviex) == 0)
+      {
+      std::ostringstream windowsVersionString;
+      windowsVersionString << osviex.dwMajorVersion << "."
+                           << osviex.dwMinorVersion << "."
+                           << osviex.dwBuildNumber;
+      windowsVersionString.str();
+      mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
+                        windowsVersionString.str().c_str());
+      }
+    else
+      {
+      // RtlGetVersion failed, so use the deprecated GetVersionEx function.
+      /* Windows version number data.  */
+      OSVERSIONINFO osvi;
+      ZeroMemory(&osvi, sizeof(osvi));
+      osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
 # pragma warning (push)
 # pragma warning (disable:4996)
 #endif
-    GetVersionEx (&osvi);
+      GetVersionEx (&osvi);
 #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
 # pragma warning (pop)
 #endif
-    std::ostringstream windowsVersionString;
-    windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
-    windowsVersionString.str();
-    mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
-                      windowsVersionString.str().c_str());
+      std::ostringstream windowsVersionString;
+      windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
+      windowsVersionString.str();
+      mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
+                        windowsVersionString.str().c_str());
+      }
 #endif
     // Read the DetermineSystem file
     std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGlobalGenerator.cxx |   55 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list