cmake_minimum_required(VERSION 2.6)
project(example-sdl)

SET (SDL_BUILDING_LIBRARY ON)
find_package ( SDL REQUIRED )
find_package ( OpenGL REQUIRED )

#
# Help to find GLUT on Windows
#

IF (WIN32)
	FIND_PATH(GLUT_ROOT_PATH "include/gl/glut.h" PATHS "C:/Program Files/Microsoft SDKs/Windows/v6.0A")
 	IF (EXISTS "${GLUT_ROOT_PATH}")
		IF (NOT EXISTS ${OPENGL_LIBRARY_DIR})
			SET (OPENGL_LIBRARY_DIR "${GLUT_ROOT_PATH}/lib")
		ENDIF()
	ELSE()
		MESSAGE (FATAL_ERROR " GLUT not found. Please specify GLUT_ROOT_PATH")
	ENDIF()
ENDIF(WIN32)
find_package ( GLUT REQUIRED )

include_directories (${SDL_INCLUDE_DIR})
include_directories (${OPENGL_INCLUDE_DIR})
include_directories (${GLUT_INCLUDE_DIR})

ADD_EXECUTABLE (example-sdl WIN32 sdl.c)

TARGET_LINK_LIBRARIES (example-sdl wiiuse)
TARGET_LINK_LIBRARIES (example-sdl ${SDL_LIBRARY})
TARGET_LINK_LIBRARIES (example-sdl ${OPENGL_LIBRARIES})
TARGET_LINK_LIBRARIES (example-sdl ${GLUT_glut_LIBRARY})
