diff options
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 68 |
3 files changed, 60 insertions, 23 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b122777..087db9e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 20150914) +set(CMake_VERSION_PATCH 20150915) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ee1b192..33b04ac 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -433,19 +433,22 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, { #if defined(_WIN32) && !defined(__CYGWIN__) /* Windows version number data. */ - OSVERSIONINFO osvi; - ZeroMemory(&osvi, sizeof(osvi)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + OSVERSIONINFOEXW osviex; + ZeroMemory(&osviex, sizeof(osviex)); + osviex.dwOSVersionInfoSize = sizeof(osviex); + #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx # pragma warning (push) # pragma warning (disable:4996) #endif - GetVersionEx (&osvi); + GetVersionExW((OSVERSIONINFOW*)&osviex); #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx # pragma warning (pop) #endif std::ostringstream windowsVersionString; - windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion; + windowsVersionString << osviex.dwMajorVersion << "." + << osviex.dwMinorVersion << "." + << osviex.dwBuildNumber; windowsVersionString.str(); mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString.str().c_str()); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 97a1df8..3857e41 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4879,11 +4879,8 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() OSVERSIONINFOEXA osvi; BOOL bOsVersionInfoEx; - // Try calling GetVersionEx using the OSVERSIONINFOEX structure. - // If that fails, try using the OSVERSIONINFO structure. - - ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA); + ZeroMemory(&osvi, sizeof(osvi)); + osvi.dwOSVersionInfoSize = sizeof(osvi); #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx # pragma warning (push) @@ -4893,14 +4890,10 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() # pragma warning (disable:4996) # endif #endif - bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi); + bOsVersionInfoEx = GetVersionExA((OSVERSIONINFOA *)&osvi); if (!bOsVersionInfoEx) { - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO *)&osvi)) - { - return 0; - } + return 0; } #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx # pragma warning (pop) @@ -4913,10 +4906,56 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() case VER_PLATFORM_WIN32_NT: // Test for the specific product family. + if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0) + { + if (osvi.wProductType == VER_NT_WORKSTATION) + { + res += "Microsoft Windows 10"; + } + else + { + res += "Microsoft Windows Server 2016 family"; + } + } + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3) + { + if (osvi.wProductType == VER_NT_WORKSTATION) + { + res += "Microsoft Windows 8.1"; + } + else + { + res += "Microsoft Windows Server 2012 R2 family"; + } + } + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) + { + if (osvi.wProductType == VER_NT_WORKSTATION) + { + res += "Microsoft Windows 8"; + } + else + { + res += "Microsoft Windows Server 2012 family"; + } + } + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1) + { + if (osvi.wProductType == VER_NT_WORKSTATION) + { + res += "Microsoft Windows 7"; + } + else + { + res += "Microsoft Windows Server 2008 R2 family"; + } + } if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) { -#if (_MSC_VER >= 1300) if (osvi.wProductType == VER_NT_WORKSTATION) { res += "Microsoft Windows Vista"; @@ -4925,9 +4964,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() { res += "Microsoft Windows Server 2008 family"; } -#else - res += "Microsoft Windows Vista or Windows Server 2008"; -#endif } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) @@ -4956,7 +4992,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() { // Test for the workstation type. -#if (_MSC_VER >= 1300) if (osvi.wProductType == VER_NT_WORKSTATION) { if (osvi.dwMajorVersion == 4) @@ -5028,7 +5063,6 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() } } } -#endif // Visual Studio 7 and up } // Test for specific product on Windows NT 4.0 SP5 and earlier |