From 71e06a536a6fb9eebf15881e9a1ddaf2f463a5f1 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 26 Nov 2021 18:27:34 -0700 Subject: [PATCH] cmake: fix Metal detection Confirmed to work on: macOS 10.15.7 XCode Version 12.4 (12D4e) --- CMakeLists.txt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f19e445c..4ea565474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1992,9 +1992,7 @@ elseif(APPLE) endif() if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL) - set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC") - check_c_source_compiles(" + check_objc_source_compiles(" #include #import #import @@ -2002,11 +2000,7 @@ elseif(APPLE) #if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64) #error Metal doesn't work on this configuration #endif - int main(void) { - return 0; - } - " HAVE_FRAMEWORK_METAL) - set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + int main(void) {}" HAVE_FRAMEWORK_METAL) if(HAVE_FRAMEWORK_METAL) set(SDL_FRAMEWORK_METAL 1) set(SDL_FRAMEWORK_QUARTZCORE 1)