Latest Xcode - Build warning

With the latest Xcode (26.0.1) and the latest release of JUCE (8.0.10) there’s a build warning whenever juce_recommended_warning_flags and juce_gui_basics are linked to any gui app:

/Users/eyalamir/Code/Sophistidating/cmake-build-debug/_deps/juce-src/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm:1923:17: warning: enumeration value ‘NSEventTypeMouseCancelled’ not explicitly handled in switch [-Wswitch-enum]1923 |         switch ([e type])|                
2 Likes

I ran into this issue a few days ago too. I forget exactly what I did to resolve it, but I think you may need to be on macOS 26 with Xcode 26.

Also make sure you run Xcode itself and fully install the macOS API:

I updated both yesterday and I’m also seeing the warning. I’m not 100% sure what the fix is yet though. We already added the switch case

           #if JUCE_MAC_API_VERSION_CAN_BE_BUILT (26, 0)
            case NSEventTypeMouseCancelled:
           #endif

However, JUCE_MAC_API_VERSION_CAN_BE_BUILT relies on MAC_OS_X_VERSION_MAX_ALLOWED which is set as follows.

/*
 * if max OS not specified, assume larger of (10.15, min)
 */
#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
    #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_14_0
        #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
    #else
        #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_14_0
    #endif
#endif

So for me at least MAC_OS_X_VERSION_MAX_ALLOWED ends up set to MAC_OS_VERSION_14_0 (14), rather than 26.

Historically I don’t think we’ve ever had to set this preprocessor definition ourselves, I assume Xcode has set it in the past but I haven’t taken a closer look to be honest.

3 Likes

Yeah I had the same - seemed weird to me that the min and max would be set to the same version. I think I may have just brute-forced it and set the max to some suitably large value.

Indeed I’m using MacOS 15.6.1 and not the latest, In my case, I have a minimum requirement of MacOS 11, but I’ve seen this warning in different projects with different target OS requirement.

Update: I updated to MacOS Tahoe, updated the Xcode build tools, ran Xcode once to make sure it installed the components… cleared the build products…

Warning is still there with CMAKE_OSX_DEPLOYMENT_TARGET set to 11.0

3 Likes

Ive been having that same issue. Im still on macos 15, not upgrading to the 26 version yet but xcode automatically did update and I honestly don’t like it. it breaks alot of things, namely gcc flags on the app

I do have a fix incoming for this but for some reason it didn’t make it through our CI yesterday.

As far as I can tell MAC_OS_X_VERSION_MAX_ALLOWED is broken (I’ll likely report that to Apple) but internally Apple rely on __MAC_OS_X_VERSION_MAX_ALLOWED so for now I’ve switched to relying on that instead.

2 Likes