# Tries to find CEGUI (http://CEGUI.bespin.org) a simple and fast 
# network library by Lee Salzman
#

SET (CEGUI_FOUND FALSE)

FIND_PATH (CEGUI_INCLUDE_DIR CEGUI.h /usr/include/CEGUI
	/usr/local/include/CEGUI $ENV{CEGUI_PATH}/include/CEGUI
	$ENV{CEGUI_INCLUDE_PATH}/CEGUI)

FIND_LIBRARY (CEGUI_BASE_LIBRARIES NAMES CEGUIBase PATHS /usr/lib /usr/local/lib $ENV{CEGUI_PATH} $ENV{CEGUI_PATH}/lib ENV{CEGUI_LIBRARY_PATH})

FIND_LIBRARY (CEGUI_RENDERER_LIBRARIES NAMES CEGUIOpenGLRenderer PATHS /usr/lib /usr/local/lib $ENV{CEGUI_PATH} $ENV{CEGUI_PATH}/lib ENV{CEGUI_LIBRARY_PATH})

SET ( CEGUI_LIBRARIES FALSE )

IF ( CEGUI_BASE_LIBRARIES AND CEGUI_RENDERER_LIBRARIES )
	SET ( CEGUI_LIBRARIES 
		${CEGUI_BASE_LIBRARIES} 
		${CEGUI_RENDERER_LIBRARIES}
		)
ENDIF ( CEGUI_BASE_LIBRARIES AND CEGUI_RENDERER_LIBRARIES )

MESSAGE (STATUS "CEGUI Libraries: ${CEGUI_LIBRARIES}")

IF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES)
	SET (CEGUI_FOUND TRUE)
ENDIF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES)

IF (CEGUI_FOUND)
   IF (NOT CEGUI_FIND_QUIETLY)
      MESSAGE(STATUS "Found CEGUI: ${CEGUI_LIBRARIES}")
   ENDIF (NOT CEGUI_FIND_QUIETLY)
ELSE (CEGUI_FOUND)
   IF (CEGUI_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "Could not find CEGUI")
   ENDIF (CEGUI_FIND_REQUIRED)
ENDIF (CEGUI_FOUND)

MARK_AS_ADVANCED (
	CEGUI_INCLUDE_DIR
	CEGUI_BASE_LIBRARIES
	CEGUI_RENDERER_LIBRARIES
	CEGUI_LIBRARIES
	)
