cmake_minimum_required(VERSION 2.6)
Project ( Tiny_Tetris_SDL )

set (
   SOURCES
   main.c
   graph.c
   compte.c
)

# REQUIRED does not work in CMake <=2.4.6 for SDL
Find_Package ( SDL REQUIRED )
Find_Package ( SDL_image REQUIRED ) # if using SDL_image
Find_Package ( SDL_ttf REQUIRED )

# Workaround for the non-working REQUIRED flag
if ( NOT SDL_FOUND )
   message ( FATAL_ERROR "SDL not found!" )
endif ( NOT SDL_FOUND )


if ( NOT SDLIMAGE_FOUND )
   message ( FATAL_ERROR "SDL_image not found!" )
endif ( NOT SDLIMAGE_FOUND )

if ( NOT SDLTTF_FOUND )
   message ( FATAL_ERROR "SDL_ttf not found!" )
endif ( NOT SDLTTF_FOUND )

include_directories (
	/usr/local/include
	/usr/local/lib
)

link_libraries (
   ${SDL_LIBRARY}
   ${SDLIMAGE_LIBRARY} # if using SDL_image, obviously
   ${SDLTTF_LIBRARY}
   "/usr/local/lib/libSDLmain.a" # Sadly not included in SDL_LIBRARY variable
)


add_executable (
   Tiny_Tetris_SDL
   WIN32 # Only if you don't want the DOS prompt to appear in the background in Windows
   MACOSX_BUNDLE
   ${SOURCES} # We could've listed the source files here directly instead of using a variable to store them
)

