Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1839 - SDL2 Cmake: VIDEO_COCOA check fails on OS X; VIDEO_C…
Browse files Browse the repository at this point in the history
…OCOA sources aren't compiled.
  • Loading branch information
slouken committed May 16, 2013
1 parent ccea22d commit 175bb1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmake/macros.cmake
Expand Up @@ -63,3 +63,11 @@ macro(LISTTOSTR _LIST _OUTPUT)
set(${_OUTPUT} "${_LPREFIX}${_ITEM} ${${_OUTPUT}}")
endforeach()
endmacro()

macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "-ObjC ${PREV_REQUIRED_DEFS}")
CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR})
set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}")
endmacro()

3 changes: 2 additions & 1 deletion cmake/sdlchecks.cmake
Expand Up @@ -449,11 +449,12 @@ endmacro(CheckX11)
#
macro(CheckCOCOA)
if(VIDEO_COCOA)
check_c_source_compiles("
check_objc_source_compiles("
#import <Cocoa/Cocoa.h>
int main (int argc, char** argv) {}" HAVE_VIDEO_COCOA)
if(HAVE_VIDEO_COCOA)
file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m)
set_source_files_properties(${COCOA_SOURCES} PROPERTIES LANGUAGE C)
set(SOURCE_FILES ${SOURCE_FILES} ${COCOA_SOURCES})
set(SDL_VIDEO_DRIVER_COCOA 1)
set(HAVE_SDL_VIDEO TRUE)
Expand Down

0 comments on commit 175bb1e

Please sign in to comment.