SDL_config_windows.h: detect winsdkver.h using __has_include()

__has_include() was added in VS 2017 15.3, so this works out to essentially
the same _MSC_VER >= 1911 check we had before for MSVC but works for non-MSVC
compilers also.
This commit is contained in:
Cameron Gutman 2021-11-05 21:06:58 -05:00
parent c48c81bd17
commit 5de723749f
1 changed files with 10 additions and 3 deletions

View File

@ -25,9 +25,16 @@
#include "SDL_platform.h" #include "SDL_platform.h"
/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK. /* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK,
* Define NO_WINSDKVER_H if your SDK version doesn't provide this, or use CMake which can detect it automatically. */ * but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence.
#ifndef NO_WINSDKVER_H * If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */
#if !defined(HAVE_WINSDKVER_H) && defined(__has_include)
#if __has_include(<winsdkver.h>)
#define HAVE_WINSDKVER_H 1
#endif
#endif
#ifdef HAVE_WINSDKVER_H
#include <winsdkver.h> #include <winsdkver.h>
#endif #endif