From 5de723749f6d7f83f243781bfec6ee5f1d3b12aa Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 5 Nov 2021 21:06:58 -0500 Subject: [PATCH] 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. --- include/SDL_config_windows.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h index 5853e5dcc..dac4b7d89 100644 --- a/include/SDL_config_windows.h +++ b/include/SDL_config_windows.h @@ -25,9 +25,16 @@ #include "SDL_platform.h" -/* 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. */ -#ifndef NO_WINSDKVER_H +/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK, + * but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence. + * 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() +#define HAVE_WINSDKVER_H 1 +#endif +#endif + +#ifdef HAVE_WINSDKVER_H #include #endif