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 1839

Summary: SDL2 Cmake: VIDEO_COCOA check fails on OS X; VIDEO_COCOA sources aren't compiled.
Product: SDL Reporter: Jake Kerr <kodafox>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Mac OS X (All)   
Attachments: A patch that fixes the CheckCOCOA cmake macro

Description Jake Kerr 2013-05-06 02:01:40 UTC
Created attachment 1130 [details]
A patch that fixes the CheckCOCOA cmake macro

Because the CHECK_C_SOURCE_COMPILES macro writes the temporary source file as .c the compilation of the check fails in the imported <Cocoa/Cocoa.h>.
It's easy to get around by making an objc specific macro that temporarily sets CMAKE_REQUIRED_DEFINITIONS to include "-ObjC" (see patch).

Also *.m sources that are added to the SOURCE_FILES list need to be marked as a language that CMake knows about or they are simply skipped. See ("set_source_files_properties" in the patch).

The patch attached allowed me to build the library, and an example Cocoa app from the command line, which ran without error.
Comment 1 Sam Lantinga 2013-05-16 03:52:56 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/1089a8a701c3