Macro for determining MacOS Deployment Target

C++17 support is not complete on MacOS depending on what deployment target is chosen.

I need to work around something, which happens when I chose deployment target < 10.14 and Language Dialect C++17.

Now the language dialect can be detected using the __cplusplus definition, but I can’t find a generally applicable way to detect what deployment target is chosen.

Do you know of any such method?

I think the macro you’re looking for is MAC_OS_X_VERSION_MIN_REQUIRED, which can be compared against predefined version numbers such as MAC_OS_X_VERSION_10_14. If you search the JUCE codebase for MAC_OS_X_VERSION_MIN_REQUIRED you’ll see some examples.

1 Like

Thank you.

I guess these are definitions that Projucer will generate and add to the Project? So it’s not a generally applicable thing like __cplusplus.

You’re correct that these definitions aren’t generally applicable in the same way as compiler built-in definitions. The macOS definitions aren’t generated by the Projucer though. Instead, they come from ‘AvailabilityVersions.h’ in the macOS SDK. That means they’ll work in any project (JUCE or otherwise) as long as that header is included.

1 Like