diff --git a/include/SDL_platform.h b/include/SDL_platform.h index ebaa25242fde0..b71d1bf34a332 100644 --- a/include/SDL_platform.h +++ b/include/SDL_platform.h @@ -70,6 +70,24 @@ /* lets us know what version of Mac OS X we're compiling on */ #include "AvailabilityMacros.h" #include "TargetConditionals.h" + +/* Fix building with older SDKs that don't define these + See this for more information: + https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets +*/ +#ifndef TARGET_OS_MACCATALYST +#define TARGET_OS_MACCATALYST 0 +#endif +#ifndef TARGET_OS_IOS +#define TARGET_OS_IOS 0 +#endif +#ifndef TARGET_OS_IPHONE +#define TARGET_OS_IPHONE 0 +#endif +#ifndef TARGET_OS_TV +#define TARGET_OS_TV 0 +#endif + #if TARGET_OS_TV #undef __TVOS__ #define __TVOS__ 1