Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed bug 1839 - SDL2 Cmake: VIDEO_COCOA check fails on OS X; VIDEO_C…

…OCOA sources aren't compiled.
  • Loading branch information
slouken committed May 16, 2013
1 parent ccea22d commit 175bb1ef3eb4fa994f7fadaf21395909bdf52b48
Showing with 10 additions and 1 deletion.
  1. +8 −0 cmake/macros.cmake
  2. +2 −1 cmake/sdlchecks.cmake
@@ -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()

@@ -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)

0 comments on commit 175bb1e

Please sign in to comment.