I want to print out (during compilation) messages telling me about some preprocessor settings in an Xcode5 C++ project. I believe there is no standard way of doing this (I've done it using tricks in VC++ before).
How can I make this code print out the actual value of __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
?
# if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 60000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
# define OGRE_PLATFORM OGRE_PLATFORM_APPLE_IOS
# else
# define OGRE_PLATFORM OGRE_PLATFORM_APPLE
# endif
This worked for me:
#define STR(X) #X
#define DEFER(M,...) M(__VA_ARGS__)
#pragma message "min version required is " DEFER(STR,__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
Hat tip (and reference link) to the Clang User Manual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With