Commit e294639a6dff23a35f3c0961eabb054c937893c4

Ryan C. Gordon 2020-06-27T02:00:58

cmake: Fix Metal detection on macOS/iOS. Apparently the "-x objective-c" made it down to the linker, who then treats the .o file as Objective-C source code. Apparently the -ObjC argument does the same thing but gets ignored by the linker. Fixes Bugzilla #4988.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b703c34..33d5055 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1742,7 +1742,7 @@ elseif(APPLE)
 
     if(VIDEO_VULKAN OR VIDEO_METAL OR RENDER_METAL)
       set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x objective-c")
+      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC")
       check_c_source_compiles("
         #include <AvailabilityMacros.h>
         #import <Metal/Metal.h>