We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5204

Summary: Metal support is not detected properly by CMake on macOS
Product: SDL Reporter: lassi
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: macOS 10.15   

Description lassi 2020-06-20 13:53:59 UTC
Hello all,

After recent updates on my MBP my setup to build my project with MoltenVK suddenly stopped working. Long story short, it turns out, for some reason HAVE_FRAMEWORK_METAL was not working.

When building with cmake, logs are plagued with:

CMakeFiles/cmTC_5407b.dir/src.c.o:1:1: error: source file is not valid UTF-8
… (2000 lines later)
CMakeFiles/cmTC_5407b.dir/src.c.o:2:934: warning: null character ignored [-Wnull-character] ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
702 warnings and 20 errors generated.
make[1]: *** [cmTC_5407b] Error 1
make: *** [cmTC_5407b/fast] Error 2

Every single character in those files seems to be somehow wrong. I tried to get this string into vscode and check encoding and line endings but it does not work. However, when I changed flags for this from -x objective-c => -ObjC it works fine. I do not code objective-c so I have no idea why this is more correct.

My environment version is:
AppleClang 11.0.3.11030032 (latest Xcode)
macOS 10.15.4
cmake version 3.17.1

I previously sent this bug report here:
https://discourse.libsdl.org/t/macos-build-issues-not-detecting-metal/27557
Comment 1 lassi 2020-09-15 02:04:44 UTC
duplicate of #4988 and fixed

*** This bug has been marked as a duplicate of bug 4988 ***