SET(headlessStubsSources
		"glewstub.c"
		"glstub.c"
		"sdlstub.c"
	)

IF    (WIN32 OR APPLE)
	# We still need these header files,
	# even if we are not going to link with SDL.
	# We have them available anyway (mingwlibs).
	FIND_PACKAGE(SDL2 REQUIRED)
	INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
	IF (MSVC)
		INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
	ENDIF ()
ELSE  (WIN32 OR APPLE)
	# Use a direct copy of the GL and SDL headers,
	# as these may not be available on headless systems.
	INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include)
	INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include/SDL2)
ENDIF (WIN32 OR APPLE)

ADD_LIBRARY(headlessStubs STATIC EXCLUDE_FROM_ALL ${headlessStubsSources})
SET_TARGET_PROPERTIES(headlessStubs PROPERTIES COMPILE_FLAGS "${PIC_FLAG}")

