Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if mac SDK is *less* than

Tags:

c

macos

I have an application that target a minimum platform of 10.5, and it compiles fine with SDK 10.6 or 10.7.

However, when compiling with an old version of xcode with 10.5 SDK, compilation fails and requires some extra #import (why it does I'm not sure, but it does). When I import the OpenGL header, I get an error about some types being unresolved. Adding #import <CarbonCore/Endian.h> fixes the problem (that's where the missing symbols are located).

I do not want to perform the #import unless absolutely necessary, and in particular not do it when compiling with 10.6 or 10.7.

I know how to check if I'm using a SDK that is superior to a given version, like so:

#if MAC_OS_X_VERSION_10_5 > MACS_VERSION_MIN_REQUIRED
// Mac > 10.5 code here
#endif

Problem is testing the reverse condition has proven to be non-trivial as all the later version of the SDK have all the defines found in earlier versions.

I'd like to find the equivalent of:

#if COMPILING_WITH_10_5_OR_EARLIER
blah
#endif

Surely, there must be an easy way I've overlooked

like image 864
jyavenard Avatar asked Jan 18 '23 07:01

jyavenard


1 Answers

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html

#if __MAC_OS_X_VERSION_MAX_ALLOWED > 1050  // note use of 1050 instead of __MAC_10_5
#   include <security/pam_appl.h>
#else
#   include <pam/pam_appl.h>
#endif
like image 70
Hofi Avatar answered Jan 25 '23 18:01

Hofi