Why are MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED no longer being honored after upgrading to macOS Sierra/Xcode 8?

Viewed 3570

My libui project must both compile on and target OS X 10.8 and newer, so I have

#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_8
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_8

in the shared header file for the Cocoa code. So far this has worked; I've seen nothing about functions deprecated after 10.9. However, after upgrading to 10.12 and Xcode 8 last night, I am suddenly seeing a whole bunch of deprecation warnings, such as

/Users/pietro/src/github.com/andlabs/libui/darwin/entry.m:181:28: warning: 
      'NSRegularControlSize' is deprecated: first deprecated in macOS 10.12
      [-Wdeprecated-declarations]
        uiDarwinSetControlFont(t, NSRegularControlSize);
                                  ^~~~~~~~~~~~~~~~~~~~
                                  NSControlSizeRegular
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:102:28: note: 
      'NSRegularControlSize' has been explicitly marked deprecated here
static const NSControlSize NSRegularControlSize API_DEPRECATED_WITH_REPL...
                           ^

as if the macros I provided are being ignored. I tried to figure out what's going on, and I'm just getting mixed signals: some sources on Apple's developer site tell me it's really __MAC_OS_X_VERSION_MIN_REQUIRED (and use a number instead of a symbolic constant for the version itself), while others tell me I'm right. Some sources seem to imply these values are determined by the compiler settings? And I can't tell what Availability.h wants anymore.

For what it's worth, this project uses CMake to build, and doesn't use Xcode projects directly.

So what am I doing wrong? Thanks.

2 Answers
Related