OSX - Vulkan support not configured but Metal is present

Hello, I just upgraded to 2.0.16 and when I try to load my vulkan dynamic library from SDL2, I have this message :

Vulkan support is either not configured in SDL or not available in current SDL video driver (cocoa) or platform

After investigation, it seems that even if I chose the options VIDEO_VULKAN and VIDEO_METAL, CMake configuration has disabled them (set to 0).

  VIDEO_COCOA            (Wanted: ON): ON
  VIDEO_DIRECTFB         (Wanted: OFF): OFF
  VIDEO_DUMMY            (Wanted: ON): ON
  VIDEO_KMSDRM           (Wanted: OFF): OFF
  VIDEO_METAL            (Wanted: 0): OFF
  VIDEO_OFFSCREEN        (Wanted: OFF): OFF
  VIDEO_OPENGL           (Wanted: ON): ON
  VIDEO_OPENGLES         (Wanted: ON): ON
  VIDEO_RPI              (Wanted: OFF): OFF
  VIDEO_VIVANTE          (Wanted: OFF): OFF
  VIDEO_VULKAN           (Wanted: 0): OFF

I saw the only way to be disabled is if we fail the compilation test which includes <Metal/Metal.h>.

#include <AvailabilityMacros.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
#if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64)
#error Metal doesn't work on this configuration
int main()
    return 0;

I tried the same snippet in XCode, I just had to name my file main.mm because of Objective-C references but it compiles correctly. What could be the issue?

My environment :

  • macOS Big Sur 11.4
  • XCode 12.5.1
  • SDL 2.0.16
  • CMake 3.21.1

So the issue is coming from the SDL CMakeLists.txt file

Before trying to compile the Metal snippet, we have to setup the compiler for Objective-C support.

In previous versions we did


Which works fine, but now we have


Which doesn’t work for me (AppleClang

I am not aware of the difference between both flags if they have the exact same purpose.

Let me know what do you think, for now i am gonna downgrade to 2.0.12.