Reputation: 21512
Is there a pre-compiler define that tells me I'm compiling for iOS?
Something like __APPLE__
that lets me know I'm compiling on a mac.
Upvotes: 2
Views: 444
Reputation: 244732
Sure; in GCC:
#ifdef __APPLE__
#include "TargetConditionals.h"
#ifdef TARGET_OS_IPHONE
// targeting the iPhone
#elif TARGET_IPHONE_SIMULATOR
// targeting the iOS simulator
#elif TARGET_OS_MAC
// targeting the Mac OS
#else
// unknown target platform
#endif
#else
// non-Apple platform
#endif
Upvotes: 3