Merge topic 'fix-vs12-GetVersionEx-warning'

3a6c3599 Suppress deprecation warnings for GetVersionEx
This commit is contained in:
Brad King 2014-11-12 09:35:49 -05:00 committed by CMake Topic Stage
commit 7d9611433b
1 changed files with 10 additions and 0 deletions

View File

@ -11,6 +11,9 @@
============================================================================*/
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "windows.h" // this must be first to define GetCurrentDirectory
#if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
#endif
#endif
#include "cmGlobalGenerator.h"
@ -456,7 +459,14 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
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);
#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# pragma warning (pop)
#endif
cmOStringStream windowsVersionString;
windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
windowsVersionString.str();