#define check for compiler (xCode/VS/ADT)

Is there a way to setup a global .h file with some #define like compiler specific code that will check for the current compiler and define things?

Something like:

#if compiler=="xCode"
#define GLOBAL_PROJECT_PATH "/development/projects/abc/"
#elseif compiler=="Visual Studio"
#define GLOBAL_PROJECT_PATH "c:/development/projects/abc/"
#elseif compiler=="ADT"
#define GLOBAL_PROJECT_PATH "/development/projects/abc/"
#endif

I found this which lists most of the common Pre-defined Macros.
http://sourceforge.net/p/predef/wiki/Compilers/

Then I need to know what xCode and ADT will define, should be something like this:

 #ifdef _XCODE_
 #define GLOBALPROJECTPATH "/development/projects/abc/"
 // Microsoft Visual Studio will define _MSC_VER
 #elseifdef _MSC_VER
 #define GLOBALPROJECTPATH "c:/development/projects/abc/"
 #elseifdef _ADT_
 #define GLOBALPROJECTPATH "/development/projects/abc/"
 #endif

yes, there actually is an “#elseifdef”, at least for Visual Studio :

You can also check whether CC_TARET_PLATFORM == CC_PLATFORM_XYZ.

Thanks!

Here’s what Cocos2d is doing:

// mac
#if defined(CC_TARGET_OS_MAC)
#undef  CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM         CC_PLATFORM_MAC
#endif

// iphone
#if defined(CC_TARGET_OS_IPHONE)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_IOS
#endif

// android
#if defined(ANDROID)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_ANDROID
#endif

// WinRT (Windows Store App)
#if defined(WINRT) && defined(_WINRT)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM			CC_PLATFORM_WINRT
#endif

// WP8 (Windows Phone 8 App)
#if defined(WP8) && defined(_WP8)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM			CC_PLATFORM_WP8
#endif

// win32
#if defined(WIN32) && defined(_WINDOWS)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_WIN32
#endif

// linux
#if defined(LINUX)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_LINUX
#endif

// marmalade
#if defined(MARMALADE)
#undef  CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM         CC_PLATFORM_MARMALADE
#endif

// bada
#if defined(SHP)
#undef  CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM         CC_PLATFORM_BADA
#endif

// qnx
#if defined(__QNX__)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM     CC_PLATFORM_BLACKBERRY
#endif

// native client
#if defined(__native_client__)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM     CC_PLATFORM_NACL
#endif

// Emscripten
#if defined(EMSCRIPTEN)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM     CC_PLATFORM_EMSCRIPTEN
#endif

// tizen
#if defined(TIZEN)
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM     CC_PLATFORM_TIZEN
#endif